2
votes

I try to run some commands in Azure PowerShell. My problem is to set the default subscription to execute several commands.

Login-AzureRmAccount # sign in with azure account is ok

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

output is:

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

I try to set the default subscription:

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

output :

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

I try use 'RM' command: Select-AzureRMSubscription -SubscriptionName 'Pay-As-You-Go' output is ok:

Environment           : AzureCloud
Account               : [email protected]
TenantId              : 6348f153-a363-32c9-b7a0-1abad0e3fc23
SubscriptionId        : c56d4caf-2095-3c0e-8fca-6db2cd3bd06b
SubscriptionName      : Pay-As-You-Go

I try to set the default subscription with 'RM' command:

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

output:

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

How can I set the default subscription?

2

2 Answers

2
votes

Since you are using the New-AzureWebSiteJob cmdlet you have to authenticate using the Add-AzureAccount cmdlet. Then you are able to select the default subscription using Select-AzureSubscription.

0
votes

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

Please try this command without 'Default':

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