gpt4 book ai didi

azure - Get-AzRecoveryServicesVault 在 devops 发布管道中抛出 "Could not load file or assembly Microsoft.Azure.PowerShell.Authentication"

转载 作者:行者123 更新时间:2023-12-03 05:36:04 34 4
gpt4 key购买 nike

Az.RecoveryServices powershell 命令 Get-AzRecoveryServicesVault 在 devops 发布管道中抛出“无法加载文件或程序集 Microsoft.Azure.PowerShell.Authentication 或其依赖项之一。系统找不到指定的文件”。该命令在管道中的 Azure powershell 任务版本 4.* 中执行。我看到的与上次成功运行的差异在于 Az.Accounts 的版本。

Import-Module -Name C:\Modules\az_3.8.0\Az.Accounts\1.8.1\Az.Accounts.psd1 -Global

在成功运行 Azure powershell 任务期间导入版本 1.8.0。

Import-Module -Name C:\Modules\az_3.8.0\Az.Accounts\1.8.0\Az.Accounts.psd1 -Global

最佳答案

好吧,我可以在我这边重现您的问题,看起来这是使用 Az.Accounts 1.8.1 以及 Az.RecoveryServices 2.8.0 时出现的错误>.

enter image description here

根据我的测试,要解决该问题,只需使用 Az.RecoveryServices 2.9.1 ,在azure powershell任务中,目前默认没有安装Az.RecoveryServices 2.9.1,所以我们需要手动安装并导入。

尝试下面的命令,它在我这边工作得很好。

Install-Module -Name Az.RecoveryServices -RequiredVersion 2.9.1 -Force
Import-Module -Name Az.RecoveryServices -RequiredVersion 2.9.1
Get-AzRecoveryServicesVault -ResourceGroupName <group-name>

enter image description here

关于azure - Get-AzRecoveryServicesVault 在 devops 发布管道中抛出 "Could not load file or assembly Microsoft.Azure.PowerShell.Authentication",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62443368/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com