Azure: more than 1 subscription?

Yes, I do have more than one.

But before getting to that, when you start a PowerShell Azure session, login like this (in a “proper” environment you might have a secured credentials file):

AddAzureRmAccount
AzurePowerShell2_01

This is the THE way to log in. Just do it. And notice the presence of RM for Resource Manager. Where there is a “with-RM” option, always take that, as alternative verb-nouns which do not include RM will tend to refer to the so-called “Classic” Azure components, aka Legacy, aka deprecated.


Moving on… I have more than 1 subscription:

AzurePowerShell2_02

I found that no permutation of Set-AzureSubscription actually set my subscription to the requested one, even though it claimed it had. For me at least, only this worked:

AzurePowerShell2_03

So, got that?
Login to your account: [AddAzureRmAccount]
Set your subscription to the required one: [Set-AzureRmContext]

AzurePowerShell2_04

And while on the basics, if PowerShell fails to recognise these commands, then run

Install-Module AzureRM

Install-Module Azure

to pick up both Resource Manager and Classic modules.

 Later… turns out that Login-AzureRmAccount is just an alias for AddAzureRmAccount

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s