As part of your governance, make sure that your naming convention applies to your Azure subscriptions. Having a consistent naming convention to the Azure subscriptions will help you to find your environments faster, and also, using PowerShell to switch subscriptions becomes a no-brainer. This weekend, I was organizing my subscriptions and noticed that I had the following subscriptions associated with my tenant.
The process to rename Azure subscriptions simple. Click on Subscriptions in your Azure Portal, then click on the desired subscription, and on the subscription’s properties page, click on Rename.
A new blade will show up. Type in the new name that you want to assign to your subscription and click save. If you are using a subscription for your different types of environments, my suggestion is to add the environment as part of the name. Something like company.dev.azure may help to identify the subscription from a glance.
The rename may take up a few minutes to refresh the new names. After a while, you will see the new names on the Subscription blade, as well as in any other areas of the Azure Portal, including the drop-down fields when creating new resources.
If you use PowerShell and want to switch subscriptions, using the new names becomes much faster and easier. First, we can check the current subscription that our session is using by entering Get-AZContext cmdlet. If we want to get a list of all existing subscriptions, we can execute Get-AZSubscription cmdlet. Both of the cmdlets are depicted in the image below.
To change the current subscription, we can execute the Select-AZSubscription cmdlet, and that is much easier than trying to remember “Visual Studio Enterprise.”
More Quick Tips articles
- New from Microsoft: Azure Security Center onboarding guide
- Fixing Azure Key Vault when moving to a different tenant
- Restore Azure Key Vault using just two PowerShell cmdlets
- This overlooked feature in Visual Studio Code can speed release time
- Enabling Front Door managed certificates in Azure: Status update