azure - 如何使用在 PowerShell 中编写的队列触发的 Azure 函数创建 Microsoft 团队?

标签 azure powershell azure-functions microsoft-teams queuetrigger

我想使用由 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/

相关文章:

.net - 受 PrefetchCount 影响的 Azure Servicebus 主题订阅竞争消费者

mysql - app.js 中的代码停止加载 CSS 资源

algorithm - 如何使用 Powershell 获取证书的安全哈希算法

powershell - 如何在powershell中传递 "get-content command "中的变量

sql-server - 什么是 Appharbors SSL SNI?它是否足以运行 Stripe Payments?

powershell - 如何运行带有BAT文件中极长参数的程序?

azure - Azure 门户中的 V3 Function App 出现奇怪错误

r - 如何在消费计划中部署适用于 R 语言的 Azure Functions 自定义处理程序?

python - 如何在 azure 函数绑定(bind)中选择日期时间周数?

asp.net - Azure 配置设置比 Web.Config 更安全?