How to move resources to another subscription or resource group in Azure?
In this manual I am going to show you how to move resources to a different subscription, region and/or resource group in Azure. For today I am going to use the Azure portal, but you can use Azure PowerShell, Azure CLI or the REST API as well to move them.
Before you start
- Most resources can be moved, but not all. Before you start moving it is good to verify wich resources can and cannot be moved. For a full list check the Microsoft docs page: Move operation support for resources
- Some services have limitations in moving. Before you move these verify what to do:
- If you’re using Azure Stack Hub, you can’t move resources between groups.
- App Services move guidance
- Azure DevOps Services move guidance
- Classic deployment model move guidance – Classic Compute, Classic Storage, Classic Virtual Networks, and Cloud Services
- Networking move guidance
- Recovery Services move guidance
- Virtual Machines move guidance
- If you move a resource that has an Azure role assigned directly to the resource (or a child resource), the role assignment isn’t moved and becomes orphaned. After the move, you must re-create the role assignment. Eventually, the orphaned role assignment is automatically removed, but we recommend removing the role assignment before the move.
- The source and destination subscriptions must exist within the same Azure Active Directory tenant. To check that both subscriptions have the same tenant ID, use Azure PowerShell or Azure CLI.
- For a move across subscriptions, the resource and its dependent resources must be located in the same resource group and they must be moved together.
STEP 1: Login to the Azure portal,
STEP 2: Only when you want to do a subscription move, if you want to move to another resource group or region go to step 3.
Open an Azure CLI window.
Run the following commands to verify if both subscriptions are both connected to the same Azure AD Tenant
(Get-AzSubscription -SubscriptionName "<your-source-subscription>").TenantId (Get-AzSubscription -SubscriptionName "<your-destination-subscription>").TenantId
The result should look like this:
STEP 3: In the Azure portal go to the resource group that you want to move resources from. For this example I am going to move a storage and an automation account to a different subscription. Select all resources that you want to move, and from the top menu select move and chose where you want to move them to.
Now select the net target subscription, and the new resource group, create one if needed.
The Azure Portal is now going to verify if resources are eligible for a resource move, this might take up a few minutes.
Wait untill the status has changed to succeeded and press next.
Final step is to move the resources!
Wait for the resource move to complete…
When the move is completed, you can verify the newly created resource group to have te resources in the new subscription (2azure New)
More information can be found on Microsoft Docs: https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/move-resource-group-and-subscription