What is my current Azure Resource Manager subscription?


Just a brief note this time. Like many who learned Azure in the old days of Azure Service Manager (a.k.a. classic IaaS), I have number of things to unlearn while adjusting to Azure Resource Manager (ARM). Today I struggled for at least thirty minutes trying to find out the default subscription in an ARM Powershell session. In the old ways it was like this; you log on, and you list the subscriptions and filter the default one:

  
  Add-AzureAccount
  Get-AzureSubscription | Where-Object isdefault -eq $true

But there is no equivalent in ARM! Sure, there is Get-AzureRMSubscription, but it has no properties indicating if a subscription is the default one or not. It turns out to be very simple. You just ask for it using Get-AzureRMContext:

  
  Add-AzureRmAccount
  Get-AzureRmContext

And to finish this off, you select a different default subscription like this:

 
  Get-AzureRmSubscription | 
    Where-Object subscriptionname -eq "contoso" | 
    Select-AzureRmSubscription 
Comments (0)

Skip to main content