Set Azure PowerShell to a specific Azure Subscription

If you have multiple Azure Subscriptions, when you login you get a default subscription set, so if you try and take any actions on a feature in another subscription you would get error.  So you need to set the correct subscription.

To set the Subscription in PowerShell so you can run cmdlets against those features, perform the following:

  • Login via PowerShell

  • Set the current subscription context

Login via PowerShell

Enter Login-AzAccount and hit enter, then provide your user id and password

Get-AzureSubscription (this will give you the list of subscription)

Set the current subscription context

Select-AzureRmSubscription -SubscriptionId xxxxx-xxxxx-xxxxxx-xxxx (this way you can set which particular subscription you want to use)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s