This blog post will show you how you can change the name of an Azure Subscription with the use of Azure CLI and Azure PowerShell.
When a proper Azure governance model is followed, you can ensure that your teams are operating in a secure and compliant Azure environment during design, development and operations. In this way you can not only minimize operational and reputational risks, but it will also help you to secure and to remain in control of your Azure environment.
As part of your Azure governance strategy, and also as a good starting point when setting up any new Azure environment, you should use a consistent well-defined naming convention for all your Azure resources. And off course this also applies for the naming of your Azure subscriptions.
If you want to read some more about applying a good and useful Azure naming convention, then you can always check out the following Microsoft Docs links. Develop your naming and tagging strategy for Azure resources and Recommended abbreviations for Azure resource types, which are both part of Microsoft’s Cloud Adoption Framework (CAF).
Rename an Azure Subscription
Open Windows Terminal (Run as administrator) and run following Azure CLI login command.
When a browser opens, sign in with your account credentials.
Before you can rename any Azure subscription your first need to know it’s subscription Id. In order to get a list of all subscriptions in the tenant with their Subscription Id from the account who is currently logged in, you need to run the following Azure PowerShell cmdlet.
When you found the subscription Id for the subscription you want to rename in the list, copy it and run the below CLI command to rename the subscription.
In the CLI command you just need change “xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx” with the copied subscription Id and “new subscription name” with your preferred new subscription name.
After running the above CLI command, you can check if the rename was successful by running the following Azure PowerShell cmdlet.
When logged into the Azure Portal with your account, type sub into the global search box. Then select Subscriptions.
On the Subscriptions window you can then see if the renaming of the subscription was successful.
As part of your Azure Governance strategy, you should use a good and well-defined naming convention for your Azure Subscriptions, just like for any other Azure resource.
To apply your naming convention to your Azure Subscriptions you can use the Azure Portal, but as shown in this blog post you can also use Azure CLI and Azure PowerShell to rename them.
This blog is part of Azure Week. Check it out for more great content!
About the Author:
Wim is an Azure Technical Advisor, who has more than fifteen years of experience with Microsoft Technologies. As a Microsoft Certified Trainer (MCT), his strength is to assist companies in the transformation of their business to the Cloud by implementing the latest features, services and solutions. Currently his main focus is on the Microsoft Hybrid Cloud Platform and especially on Microsoft Azure and the Azure hybrid services.
Wim is also a Microsoft MVP in the Azure category and a founding board member of the MC2MC user group.
As a passionate community member he regularly writes blogs and speaks about his daily experiences with Azure.
Matthyssen, W. (2021). Azure Governance: Rename an Azure Subscription with Azure CLI and PowerShell. Available at: https://wmatthyssen.com/2021/04/21/azure-governance-rename-an-azure-subscription-with-azure-cli-and-powershell/ [Accessed: 8th July 2021].