Cormac O'Brien
Cormac O'Brien

Reputation: 93

How do you move VMs with managed disks between resource groups

Created a VM recently and managed disks are now an option, so after looking at all the benefits I decided we should use these for VMs going forward. Now I want to tidy up the resource groups I'm managing. I can move all the old VMs between resource groups, but the new VM can't be moved. The validation fails saying that the resource group of the managed disk cannot be changed. Is this correct?

Upvotes: 6

Views: 6091

Answers (4)

Sohail Ahmed
Sohail Ahmed

Reputation: 1190

You cannot move Azure Managed Disks at this time but the following steps can be used to snapshot and redeploy them between resource groups/subscriptions.

  1. Copy snapshot of a managed disk in same subscription or different subscription with PowerShell or CLI

  2. Create a virtual machine from a snapshot with PowerShell or CLI

Upvotes: 0

Adel Khayata
Adel Khayata

Reputation: 2816

Managed disks are supported for move as of September 24, 2018.

You'll have to register to enable this feature.

Register-AzureRmProviderFeature -FeatureName ManagedResourcesMove -ProviderNamespace Microsoft.Compute

The registration request initially returns a state of Registering. You can check the current status with:

Get-AzureRmProviderFeature -FeatureName ManagedResourcesMove -ProviderNamespace Microsoft.Compute

Wait several minutes for the status to change to Registered.

After the feature is registered, register the Microsoft.Compute resource provider. Perform this step even if the resource provider was previously registered.

Register-AzureRmResourceProvider -ProviderNamespace Microsoft.Compute

Source: Move resources to new resource group or subscription

Upvotes: 1

By now, we're moving VMs with managed disk following this procedure:

  1. Stop VM
  2. Create managed disks snapshots
  3. Create new managed disks from snapshots in the new Resource Group
  4. Deploy new vm using using managed disks in the new Resource Group

I'm sure moving managed disk is comming soon (I hope)

Upvotes: 5

bmoore-msft
bmoore-msft

Reputation: 8717

Moving VMs with managed disks isn't supported yet - it will be soon.

Upvotes: 4

Related Questions