ASM had the ability to change the default subscription with the -Default (and now deprecated) parameter
Select-AzureSubscription -Default
but the ARM version
Select-AzureRMSubscription
does not have the -Default parameter.
How can I change the default ARM subscription? It is very annoying that my default is a subscription that I never use.
Edit for clarification: When I say change default subscription I mean the default subscription that you are connected to with each new PowerShell session.
You can change the default settings of the Azure portal to meet your own preferences. Most settings are available from the Settings menu in the top right section of global page header.
To change the azure subscription using PowerShell, we can use the Select-AZSubscription command. When you use this command, you can use either the subscription ID, Subscription Name, or the Tenant ID.
Change the active subscription In order to change subscriptions, you use the Set-AzContext cmdlet to change the current context. You can use the Get-AzSubscription cmdlet to retrieve a list of your Azure subscriptions.
The Set-AzureRmContext cmdlet sets authentication information for cmdlets that you run in the current session. The context includes tenant, subscription, and environment information.
Step 1: Get-AzureRmSubscription
It will List all your subscriptions.
Step 2: Select-AzureRmSubscription -SubscriptionId xxxxx-xxxxx-xxxxxx-xxxx
The SubscriptionID can be found in the output of the Get-AzureRmSubscription. You can also use the SubscriptionName.
Step 3: (Get-AzureRmContext).Subscription
Confirm that you have selected the right subscription.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With