我正在尝试使用
登录 Azure 门户Connect-AzAccount
此代码要求我输入我不想要的提示,我们可以使用一些简单的配置脚本自动登录吗?
最佳答案
正如Joy所说,您可以通过凭据使用用户帐户登录,但不会出现任何提示,请确保您的帐户没有启用MFA。
$User = "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4038383800383838386e2f2e2d2923322f332f26346e232f2d" rel="noreferrer noopener nofollow">[email protected]</a>"
$PWord = ConvertTo-SecureString -String "<Password>" -AsPlainText -Force
$tenant = "<tenant id>"
$subscription = "<subscription id>"
$Credential = New-Object -TypeName "System.Management.Automation.PSCredential" -ArgumentList $User,$PWord
Connect-AzAccount -Credential $Credential -Tenant $tenant -Subscription $subscription
更多详情可以引用这个SO thread .
关于azure - Connect-AzAccount 无提示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61098097/