MS Azure PowerShell - 订阅名称不存在

MS Azure PowerShell - The subscription name doesn't exist

我尝试 运行 Azure PowerShell 中的一些命令。我的问题是设置默认订阅来执行多个命令。

Login-AzureRmAccount # sign in with azure account is ok

New-AzureWebSiteJob -Name 'MyApp1' -JobName 'GetDate' -JobType Continuous -JobFile '.\Job.zip'

输出为:

No default subscription has been designated. Use Select-AzureSubscription -Default to set the default subscription.

我尝试设置默认订阅:

Select-AzureSubscription -Default -SubscriptionName 'Pay-As-You-Go'

输出:

The subscription name Pay-As-You-Go doesn't exist.

我尝试使用 'RM' 命令:Select-AzureRMSubscription -SubscriptionName 'Pay-As-You-Go' 输出正常:

Environment           : AzureCloud
Account               : peter111@gmail.com
TenantId              : 6348f153-a363-32c9-b7a0-1abad0e3fc23
SubscriptionId        : c56d4caf-2095-3c0e-8fca-6db2cd3bd06b
SubscriptionName      : Pay-As-You-Go

我尝试使用 'RM' 命令设置默认订阅:

Select-AzureRMSubscription -Default -SubscriptionName 'Pay-As-You-Go'

输出:

Set-AzureRmContext : A parameter cannot be found that matches parameter name 'Default'.

如何设置默认订阅?

由于您使用的是 New-AzureWebSiteJob cmdlet,因此您必须使用 Add-AzureAccount cmdlet 进行身份验证。然后您可以使用 Select-AzureSubscription.

select 默认订阅

Set-AzureRmContext : A parameter cannot be found that matches parameter name 'Default'.

请在没有 'Default' 的情况下尝试此命令:

Select-AzureRMSubscription -SubscriptionName 'Pay-As-You-Go'