具有Azure功能的Connect-azureAD Powershell

时间:2019-10-01 17:38:07

标签: azure powershell azure-functions azure-function-app

我需要使用Powershell脚本在azure函数应用中连接到AD。 (因为它在功能上,我需要没有提示就这样做) 我正在尝试:

# Import AzureAD 
Import-Module "D:\home\site\modules\AzureAD.psd1" -ErrorAction SilentlyContinue

$appId = "myAppId"
$thumb = "certThumb"
$tenantId = "myTenantId"
Connect-AzureAD -TenantId $tenantId -ApplicationId  $appId -CertificateThumbprint $thumb

不幸的是,我遇到以下错误:

The term 'Connect-AzureAD' is not recognized as the name of a cmdlet, function, script file, or operable program.

我将azureAd模块复制到了功能应用程序的fs,但导入它仍然看起来没有任何结果。

您知道一种解决方法吗?

1 个答案:

答案 0 :(得分:1)

在Azure Functions中使用AzureAD模块现在需要一种变通方法:https://github.com/Azure/azure-functions-powershell-worker/issues/232#issuecomment-536744760

这可能很快就会解决。

顺便说一句,不要将模块复制到您的应用中,而应考虑使用Managed Dependencies feature