Select Azure 自动化订阅
Select Subscription in azure automation
我正在尝试在 Windows Azure 中启动和 运行 自动化脚本。
我收到一条错误消息,告诉我必须使用 Select-AzureSubscription。
这个失败并出现以下错误:
Error: Select-AzureSubscription : The subscription named 'xxx' cannot be found. Use Set-AzureSubscription to
initialize the subscription data.
Parameter name: name
At my-script:15 char:15
+
+ CategoryInfo : CloseError: (:) [Select-AzureSubscription], ArgumentException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.Profile.SelectAzureSubscriptionCommand
所以我使用了 Set-AzureSubscription,但这个也失败了。
我尝试传递订阅名称和订阅 ID。
有人设法正确配置了吗?
您需要使用 Add-AzureAccount 设置 Azure 身份验证。有关详细信息,请参阅 https://msdn.microsoft.com/en-us/library/azure/dn865019.aspx。
在选择订阅之前,您需要通过任何可用的方法添加您的 Azure 帐户。最简单的一种是使用凭据
$username = "your username"
$password = ConvertTo-SecureString 'yourpassword' –asplaintext –force
$Cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $password
<#you can also use Azure assets to store the credential and use it directly like
$Cred=Get-AutomationPSCredential -Name $AzureAccountCredentialName
#>
Add-AzureAccount -Credential $Cred
#Now select your subscription
我正在尝试在 Windows Azure 中启动和 运行 自动化脚本。 我收到一条错误消息,告诉我必须使用 Select-AzureSubscription。 这个失败并出现以下错误:
Error: Select-AzureSubscription : The subscription named 'xxx' cannot be found. Use Set-AzureSubscription to
initialize the subscription data.
Parameter name: name
At my-script:15 char:15
+
+ CategoryInfo : CloseError: (:) [Select-AzureSubscription], ArgumentException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.Profile.SelectAzureSubscriptionCommand
所以我使用了 Set-AzureSubscription,但这个也失败了。 我尝试传递订阅名称和订阅 ID。
有人设法正确配置了吗?
您需要使用 Add-AzureAccount 设置 Azure 身份验证。有关详细信息,请参阅 https://msdn.microsoft.com/en-us/library/azure/dn865019.aspx。
在选择订阅之前,您需要通过任何可用的方法添加您的 Azure 帐户。最简单的一种是使用凭据
$username = "your username"
$password = ConvertTo-SecureString 'yourpassword' –asplaintext –force
$Cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $password
<#you can also use Azure assets to store the credential and use it directly like
$Cred=Get-AutomationPSCredential -Name $AzureAccountCredentialName
#>
Add-AzureAccount -Credential $Cred
#Now select your subscription