Earlier this week someone asked my if it’s possible to rename Azure Resource Group for Governance purposes. Unfortunately you can’t rename resource groups, but… don’t wurry there are ways to achieve the same goal.
Option 1 Create and move..
The first option is that you create a resource group with the new name.
Just go to Resource Groups and hit that create button!
Now go to the resource group with the old name and select all resources and click move
Notice that you have 2 options, move to another subscription or to another resource group :
Choose to move to another resource group.
Now select the resource group you’ve just created and check the box. All the resources are now moved. Watch out for the completion notification. Now go to the old resource group, re-check that there are no more resources available and choose the delete option :
Notice that tools and scripts who use resource IDs hardcoded might fail because the newly created resource group has a different Resource ID.
Option 2 CLI baby…. 🙂
For the techies… it’s a easier way to do this. We could use CLI (oh yeahhh) :
First step, create a new resource group :
az group create -l westus -n MyResourceGroup
Now move all the resources from the old resource group to the new resource group:
Get-AzureRmResource -ResourceGroupName <sourceResourceGroupName> | Move-AzureRmResource -DestinationResourceGroupName <destResourceGroupName>
And finally delete the old resource group :
az group delete -n MyResourceGroup