Locating all of your subscriptions and subscription information in Azure via Powershell

In order to gather Azure subscription information you can run the following command(s). There are several switches you can add to get specific information about your subscriptions. If you haven’t installed Windows Azure Powershell (Azure Powershell install details) you will need to start by doing that.

The first command is fairly simple. This will display subscription information for all of the subscriptions listed in your AzurePublishSettingsFile (reference). Below is information for just one subscription.

PS C:\> Get-AzureSubscription

SubscriptionName           : Subscription1

SubscriptionId             : xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

Certificate                : [Subject]

CN=Windows Azure Tools

[Issuer]

CN=Windows Azure Tools

[Serial Number]

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

[Not Before]

5/5/2013 8:00:00 PM

[Not After]

5/5/2014 8:00:00 PM

[Thumbprint]

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

ServiceEndpoint            : https://management.core.windows.net/
SqlAzureServiceEndpoint    :
CurrentStorageAccount      :
IsDefault                  : True
CurrentCloudStorageAccount :

To list out the names of all of your subscriptions you can run the following command. This will list all subscriptions by name

PS C:\> Get-AzureSubscription | fl SubscriptionName

SubscriptionName : Subscription1

SubscriptionName : Subscription2

SubscriptionName : Subscription3

SubscriptionName : Subscription4

The following command will display all subscriptions with name and subscription ID’s included.

PS C:\> Get-AzureSubscription | fl SubscriptionName, SubscriptionId

SubscriptionName : Subscription1

SubscriptionId   : xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

SubscriptionName : Subscription2

SubscriptionId   : xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

SubscriptionName : Subscription3

SubscriptionId   : xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

SubscriptionName : Subscription4

SubscriptionId   : xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

If you want to determine which subscription is the default subscription when you launch Powershell the following command will give you the details

PS C:\> Get-AzureSubscription | fl SubscriptionName, IsDefault

SubscriptionName : Subscription1

IsDefault        : True

SubscriptionName : Subscription2

IsDefault        : False

SubscriptionName : Subscription3

IsDefault        : False

SubscriptionName : Subscription4

IsDefault        : False

Now that you have all of the subscription information you can pick the subscription you want to gather information from by running PowerShell commands against it. By default Azure PowerShell will have a default subscription. In this example our default subscription is “Subscription1”. To change to “Subscription4” running the following command

PS C:\> Select-AzureSubscription

cmdlet Select-AzureSubscription at command pipeline position 1 Supply values for the following parameters: (Type !? for Help.) SubscriptionName: Subscription4

No the commands you run will run again “subscription4” instead of the default subscription

Share Button
Author: JA


Leave a Reply

Your email address will not be published. Required fields are marked *