At the beginning of the week, a customer asks me how he can migrate resource group from one subscription to another. He had a CSP contract and he needed to deploy “Bring-your-own-Licenses” products that were not available in CSP. So, he subscribed to an EA contract. Then he wanted to move resources from CSP to EA. However, he had a lot of dependent resources inside several resource groups. This topic shows you how to make this migration.
Overview of the process
To show you the process, I created three resource groups with the prefix Mig-.
The Mig-RGVMs resource group contains a virtual machine and its public IP, network interface and disk.
The Mig-RGSto resource group contains a storage account to store boot diagnostics of the above VM.
The Mig-RGNetwork resource group contains the virtual network for the above VM.
This example shows a solution with a VM in a resource group that have dependence with resources inside of other resource groups. Because you can migrate resource groups one by one, you can move any of these resource groups to the new subscription. It will fail because of dependence.
So, to be able to migrate your resource to a new subscription we have to:
- Move all resources to a temporary resource group (called Mig-RGTemp in this example)
- Move the resource group Mig-RGTemp to the new subscription
- Recreate your resource groups as the source subscription and move your resource from Mig-RGTemp to the destination resource groups.
Let’s go !
Move resource in a temporary resource group
First create a resource group in the source subscription. I called it Mig-RGTemp.
Once the resource group is created, I navigate to the Mig-RGSto resource group to migrate the storage account. I select the storage account and I click on move > move to another resource group.
Then I select the destination resource group called Mig-RGTemp and I click on OK to start the migration.
Next I do the same thing for resources in Mig-RGNet
And finally, I migrate also the resources in Mig-RGVMs to Mig-RGTemp.
Now, all resourcers are inside the same resource group (Mig-RGTemp)
Migrate the resource group to another subscription
First, create the resource group in the destination subscription. I give the same name as the source resource group:
To migrate the resource group to the other subscription, open it and click on move > move to another subscription.
Then select all resources and choose the right subscription and destination resource group. I click on OK to start the migration.
Once the migration is finished, (it can take a while) you can create the resource groups in the destination subscription and move resource from temporary resource group into the new ones.