我在Jenkins中有一个自由式作业,其中包含powershell构建步骤,如下所示:
az account clear
$pwd1 = "testpwd"
$uname = "testuser"
az login -u "$uname" -p "$pwd1"
Set-AzContext -SubscriptionId <subscription-id>
...
但我得到的错误:
Set-AzContext : The term 'Set-AzContext' is not recognized as the name of a cmdlet, function, script file, or operable
你知道为什么会发生这种事吗?或者我该怎么解决?
1条答案
按热度按时间rqqzpn5f1#
Az
模块似乎不可用。请运行以下命令:如果缺少
Set-AzContext
,或者根本没有列出任何内容,则需要安装Az模块。为此,请参阅official documentation。