Auldhouse Blog

PowerShell Pitfalls for Managing Multiple Azure Accounts

14-Nov-2014 15:00:00 / by James Finley

Or PPMMAA for short . . .

Many (Most?) of the PowerShell and scripting examples for Azure management via PowerShell start with a command sequence that looks like either this:



Or this:


In either case, when you are finished and you run


You get a result set that looks like this:

If you look closely at the output you’ll notice that in addition to the expected properties for each subscription, like “SubscriptionName” and “SubscriptionId” there are two unloved little properties near the bottom of the list for each subscription “IsCurrent” and “IsDefault”. These two are important to use when are using the Microsoft Azure PowerShell console for Azure Management.

Basically, anytime you run an Azure management cmdlet, unless it has a switch that allows you to manually set an account or subscription to run against, ANNNNNDDDDD you happen to use that switch to specify a subscription, any cmdlet you run will execute against the current subscription, i.e. the one that has “IsCurrent: True”. By default, the subscription that has the “IsDefault” property equal to “True” will be the current account. (Funny how that works out, eh?). Which is all well and groovy if you happen to be managing VMs, networks and services in that subscription.

But James, what if I don’t want to manage that subscription? I need to manage one of the others. What shall I do?

Fortunately, we have the means to change the current and default subscriptions. And it is fairly easy to do.

The basic syntax to change the focus to a particular subscription is as follows:

Select-AzureSubscription -Name <SubscriptionName> -Current

The focus for your Azure cmdlets will now be on that subscription until you change it by using the Select-AzureSubscription or until you close the PowerShell console you’re working in. A new console will load up the default subscription as the focus

If you would like a particular subscription to be one that is the defaults in the future, it would be this:

Select-AzureSubscription -Name <SubscriptionName> -Default

After you have ran these cmdlets, run the Get-AzureSubscription cmdlet again to verify that the subscription you identified has now been set as either the current or default subscription. Once it is you are now free to go ahead and manage away!

Got any hints or tips of your own? - share them via the comments below.

Looking to develop a better understanding of Microsoft Azure? Check out these two courses offered by Auldhouse

Microsoft Azure for IT Professionals and Implementing Microsoft Azure Infrastructure Solutions 

First published by James Finley on 


Topics: MS Technical Training & Certification - Azure, Getting more from Azure

James Finley

Written by James Finley

I’m a Microsoft Certified Trainer (MCT), based in Auckland, New Zealand. I’m a Senior Systems Trainer for Auldhouse, the largest corporate computer training company in New Zealand. I spend most of my time training on Microsoft Exchange, Lync, SharePoint, PowerShell, Hyper-V and VMWare with a little Windows Server thrown in the mix just for fun. This blog is meant to give some guidance and insight into how to use and manage these products, as well as helping keep people up to date on topics of interest around Microsoft certifications. With a little random silliness thrown in from time to time. In my IT career I’ve been fortunate enough to have opportunities to contribute to books, review courseware, deliver sessions on behalf of Microsoft and speak at Microsoft TechEd and other events.