【发布时间】:2016-01-05 19:47:20
【问题描述】:
4 天前(2014 年 8 月 4 日)发布了 Azure Powershell 的新版本,其中在 Add-AzureAccount cmdlet 中包含了一个新的 -Credential 参数。我正在尝试使用它,但我显然做错了什么。 首先,我将密码存储在一个文件中:
read-host -assecurestring | convertfrom-securestring | out-file C:\temp\securestring.txt
然后尝试在 Add-AzureAccount 中使用它
$password = cat C:\temp\securestring.txt | convertto-securestring
$username = "dhdom1\jamiet" #yes, this is the correct username
$mycred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username,$password
Add-AzureAccount -credential $mycred
调用 Add-AzureAccount 失败:
Add-AzureAccount : user_realm_discovery_failed: 用户领域发现 失败:远程服务器返回错误:(404) Not Found。
我知道“dhdom1\jamiet”是正确的帐户。任何人都知道为什么这可能会失败? TIA
【问题讨论】:
-
虽然我一直坚持让这个在本地工作,但很想知道您是如何将上述内容改编为自动化运行手册或功能应用程序的?
标签: powershell azure