当我尝试从VS Code终端登录Azure RM时,它就会卡住。没有显示登录/密码提示。
有没有办法从该终端登录?否则,运行/调试Azure PS脚本将比应该更复杂 :)
当我尝试从VS Code终端登录Azure RM时,它就会卡住。没有显示登录/密码提示。
有没有办法从该终端登录?否则,运行/调试Azure PS脚本将比应该更复杂 :)
登录窗口会在后台弹出...如果你最小化所有窗口,最终你会找到它。
请稍等片刻,然后您将能够看到登录页面。
根据您的描述,我建议您选择非交互式登录。您可以创建一个能够访问资源的服务主体。请参考此链接:使用门户创建可访问资源的 Azure Active Directory 应用程序和服务主体。您将获得客户端 ID 和客户端密钥。您可以使用以下代码登录 Azure 帐户。
$subscriptionId=""
$tenantid=""
$clientid=""
$password=""
$userPassword = ConvertTo-SecureString -String $password -AsPlainText -Force
$userCredential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $clientid, $userPassword
Login-AzureRmAccount -TenantId $tenantid -ServicePrincipal -SubscriptionId $subscriptionId -Credential $userCredential