Powershell 登录AzureRMAccount与组织帐户非交互失败

Powershell 登录AzureRMAccount与组织帐户非交互失败,powershell,azure,azure-active-directory,azure-automation,Powershell,Azure,Azure Active Directory,Azure Automation,我可以通过弹出窗口登录AzurerAccount。我需要在VSTS CI主机中使用非交互模式。当我尝试在我的计算机上执行以下操作时: $username = "my org login" $pass = ConvertTo-SecureString "Mypass" -AsPlainText -Force $cred = New-Object PSCredential($username,$pass) Login-AzureRmAccount -Credential $cred 我得到消息:

我可以通过弹出窗口登录AzurerAccount。我需要在VSTS CI主机中使用非交互模式。当我尝试在我的计算机上执行以下操作时:

$username = "my org login"
$pass = ConvertTo-SecureString "Mypass" -AsPlainText -Force
$cred = New-Object PSCredential($username,$pass)
Login-AzureRmAccount -Credential $cred
我得到消息:

Login-AzureRmAccount : accessing_ws_metadata_exchange_failed: Accessing WS 
metadata exchange failed: The underlying con
nection was closed: An unexpected error occurred on a send.
At line:1 char:1
+ Login-AzureRmAccount -Credential $cred
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : CloseError: (:) [Connect-AzureRmAccount], 
AadAuthenticationFailedException
+ FullyQualifiedErrorId : 
Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand

我没有主意了。

您不能对启用MFA的帐户使用静默身份验证。您必须走其他路线。

您是否有可能启用了MFA?@4c74356b41 99%表示MFA已启用。是AAD还是特定于用户?我可以向管理员申请禁用MFA的技术帐户,然后我将与服务负责人一起尝试。我将与服务负责人一起尝试。当然,请接受此答案,因为它回答了您的问题:)