Manage multiple Azure subscriptions
Warning
The AzureRM PowerShell module has been officially deprecated as of February 29, 2024. Users are advised to migrate from AzureRM to the Az PowerShell module to ensure continued support and updates.
Although the AzureRM module may still function, it's no longer maintained or supported, placing any continued use at the user's discretion and risk. Please refer to our migration resources for guidance on transitioning to the Az module.
If you're brand new to Azure, you probably only have a single subscription. But if you have been using Azure for a while, you may have created multiple Azure subscriptions. You can configure Azure PowerShell to execute commands against a particular subscription.
Get a list of all subscriptions in your account.
Get-AzureRmSubscription
Environment : AzureCloud Account : username@contoso.com TenantId : 00000000-0000-0000-0000-000000000000 SubscriptionId : 00000000-0000-0000-0000-000000000000 SubscriptionName : My Production Subscription CurrentStorageAccount : Environment : AzureCloud Account : username@contoso.com TenantId : 00000000-0000-0000-0000-000000000000 SubscriptionId : 00000000-0000-0000-0000-000000000000 SubscriptionName : My DevTest Subscription CurrentStorageAccount : Environment : AzureCloud Account : username@contoso.com TenantId : 00000000-0000-0000-0000-000000000000 SubscriptionId : 00000000-0000-0000-0000-000000000000 SubscriptionName : My Demos CurrentStorageAccount :
Set the default.
Select-AzureRmSubscription -Subscription 'My Demos'
Verify the change by running the
Get-AzureRmContext
cmdlet.Get-AzureRmContext
Environment : AzureCloud Account : username@contoso.com TenantId : 00000000-0000-0000-0000-000000000000 SubscriptionId : 00000000-0000-0000-0000-000000000000 SubscriptionName : My Demos CurrentStorageAccount :
Once you set your default subscription, all Azure PowerShell commands run against this subscription.