我想使用由 Azure 队列触发的 azure 函数创建一个团队。 不幸的是,当我运行代码时,它无法在 Azure 函数内运行。
我想知道。有没有办法在 Azure Function 中使用 PowerShell 创建 Microsoft 团队?
Import-module MicrosoftTeams
$group = New-Team -MailNickname "teamTitle" -displayname "teamTitle" -Visibility "private"
Add-TeamUser -GroupId $group.GroupId -User "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4b3e382e390b2e3f2865282426" rel="noreferrer noopener nofollow">[email protected]</a>"
New-TeamChannel -GroupId $group.GroupId -DisplayName "General"
在本地工作。不在 Azure Function 中工作。
下面是我收到的错误:
ERROR: Import-Module : The specified module 'MicrosoftTeams' was not loaded because no valid
module file was found in any module directory. At D:\home\site\wwwroot\CreateTeam\run.ps1:3
char:1 + Import-Module MicrosoftTeams + [...]
谢谢
最佳答案
根据错误消息,您的 Function 应用未安装 MicrosoftTeams 模块。您需要将此模块的引用包含到 requirements.psd1
文件中(有关更多详细信息,请参阅 https://learn.microsoft.com/azure/azure-functions/functions-reference-powershell#dependency-management)。
关于azure - 如何使用在 PowerShell 中编写的队列触发的 Azure 函数创建 Microsoft 团队?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63117429/