繁体   English   中英

Connect-AzAccount 没有提示

[英]Connect-AzAccount without prompt

我正在尝试使用登录到 Azure 门户

Connect-AzAccount

这段代码要求我提供一个我不想要的提示,我们可以使用一些简单的配置脚本自动登录吗?

正如乔伊所说,您可以使用不会提示的凭据登录用户帐户,请确保您的帐户未启用 MFA。

$User = "xxx@xxxx.onmicrosoft.com"
$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 线程

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM