我有一个尝试连接到 Azure 的英雄 PowerShell 脚本:
$username = "asdfasdf"
$password = "asdfasdf"
$secstr = New-Object -TypeName System.Security.SecureString
$password.ToCharArray() | ForEach-Object {$secstr.AppendChar($_)}
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $secstr
Add-AzureAccount -Credential $cred
Select-AzureSubscription -SubscriptionId asdfasdf
Run Code Online (Sandbox Code Playgroud)
但我收到此错误:
Add-AzureAccount : user_realm_discovery_failed: User realm discovery failed: Unable to connect to the remote
server
At line:6 char:1
+ Add-AzureAccount -Credential $cred
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Add-AzureAccount], AadAuthenticationFailedException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.Profile.AddAzureAccount
Run Code Online (Sandbox Code Playgroud)
我的用户绝对是 Azure 目录的共同管理员。是否必须使用代理才能与 Azure 通信?
小智 6
嗯,由于各种原因,这似乎是一个常见的错误。尝试连接到服务结构时,我的用户名格式错误并出现错误:
user_realm_discovery_failed:用户领域发现失败
即somedomain\fred应该是fred@somedomain.com。
一旦我纠正它工作正常。因此,鉴于上面的答案,此错误似乎是由于连接或身份验证问题所致。
| 归档时间: |
|
| 查看次数: |
5684 次 |
| 最近记录: |