【问题标题】:Connect-azureAD powershell in azure function在 Azure 功能中连接-azureAD powershell
【发布时间】:2019-10-01 17:38:07
【问题描述】:

我需要使用 powershell 脚本在 azure function app 中连接到 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 中,但仍然看起来导入它并没有任何结果。

你知道解决方法吗?

【问题讨论】:

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


    【解决方案1】:

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

    这可能很快就会解决。

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

    【讨论】:

    • 目前托管依赖项功能的方式不起作用。第一种方法有效 - 感谢 Anatoli!
    • @bryniek 我的意思是托管依赖项将负责将模块文件传递到文件系统,而无需手动将模块包含到您的应用程序中。即使对于 AzureAD 模块,这似乎也可以正常工作。但是仍然需要定位和生成 64 位 powershell.exe。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-12-24
    • 2022-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-08-02
    • 2020-11-06
    • 2016-05-13
    相关资源
    最近更新 更多