title | description | ms.devlang | ms.topic | ms.custom |
---|---|---|---|---|
Manage Azure subscriptions with Azure PowerShell |
Manage Azure subscriptions with Azure PowerShell |
powershell |
conceptual |
devx-track-azurepowershell |
[!INCLUDE migrate-to-az-banner]
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.