Moving a VM to another Resource Group

Table of Contents

Generally we can envisage particular naming conventions for Resource Groups (RG) that will stand the test of time. In Azure, once you create a Resource Group, you cannot rename it, period.
There could be a reason to create a new RG and move a VM that is now managed by a different team using role-based access control (RBAC) roles defined at the RG-level, or there has been some rebranding, so an RG containing the resources needs reflect a new naming structure. 
Below are some examples of how a VM can me moved into a new Resource Group, depending on its circumstance.

VM with no Azure Backup or Availability Set

For simple environments where you do not have Availability Sets (AS) or do not use Recovery Services vault to backup VM’s, moving a VM is relatively simple:

  1. Schedule a planned outage and stop (deallocate) the virtual machine

  2. Go into the Resource Group > Resource Group name that contains the VM’s resources and select ‘Show hidden types’ under the [Overview] blade

  3. Select [Move] and select ‘Move to another resource group’

  4. Select all the associated resources for that VM, VM resource, disk(s), NIC(s)

  5. Choose the Resource group under the ‘Resource group’ drop down and acknowledge the warning > [OK]

  6. Depending on the resource types and sizes, the move may take several minutes; please be patient

  7. Power on the VM to confirm functionality; this might take longer than expected
VM with Azure Backup

If you use Recovery Services vault (Azure Backup) to back up your VM, there are additional steps to do before moving:

  1. Ensure the VM has been successfully been backed up before proceeding 

  2. Stop (deallocate) the VM 

  3. Navigate to the Resource Group that is used for the Recovery Services vault, ie: AzureBackupRG_eastus_1 and select 'Show hidden types'  

  4. Find the resource with the VM name you wish to move, prepending with the name AzureBackup_, ie: AzureBackup_MyVM_xxxxxxxxxxxx, delete this instant recovery point that is used by the Recovery Services vault (RSV).
    If this fails to delete the instant recovery point, use PowerShell or CloudShell to forcibly delete, ie: 

Remove-AzResource -ResourceId "/subscriptions/aaaaaaaa-1111-2222-3333-112233445566/resourceGroups/AzureBackupRG_eastus_1/providers/Microsoft.Compute/restorePointCollections/AzureBackup_MyVM_112233445566778" -Force 
  1. Navigate to the source Resource Group containing the VM and select [Move] > ‘Move to another Resource group’ 
  2. Select the associated VM’s resources, desired RG, acknowledge and move the VM

Note: Use Get-AzResource | Out-GridView to find all resources that make the VM to help in selecting all the resources in the Azure Portal before moving.

  1. Power on the VM to confirm functionality; this might take longer than expected

  2. Once the VM and associated resources have successfully been moved, you need to re-associate the VM to the Recovery Services vault backup; select the same Backup Policy which it was originally associated with.
VM with Azure Backup and in a Availability Set

If a VM is associated with an Availability Set (AS), you'll need to select one of the following options: 

  • Move the Availability Set, along with all other associated VM's and their resources into the new Resource Group 


  • Rebuild the VM, involving: 
    • Removing BitLocker/AzureDiskEncryption, if applicable
    • Create a backup without disk encryption 
    • Stop the VM Backup 
    • Delete the restore points under the AzureBackupRG_... Resource Group 
    • Delete the VM resource, not the associated VHD(s) 
    • Move the VHD(s) into the new Resource Group 
    • Rebuild VM from the VHD of the deleted VM, not including the new VM in an AS 
    • Re-enable BitLocker 
    • Include the VM into backup