Move Azure Virtual Machine to Another Subscription | Best Practice for Azure Administration

Move Azure Virtual Machine to Another Subscription

Question

You have an Azure tenant that contains two subscriptions named Subscription1 and Subscription2.

In Subscription1, you deploy a virtual machine named Server1 that runs Windows Server 2016. Server1 uses managed disks.

You need to move Server1 to Subscription2. The solution must minimize administration effort.

What should you do first?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

D

To move existing resources to another resource group or subscription, use the Move-AzureRmResource cmdlet.

https://docs.microsoft.com/en-in/azure/azure-resource-manager/resource-group-move-resources#move-resources

To move a virtual machine with managed disks from one subscription to another in Azure, you need to follow these steps:

  1. Ensure that the source and destination subscriptions are registered with Azure Site Recovery.
  2. Grant the necessary permissions to the user account that will perform the move operation. This user should have the "Contributor" role assigned to both the source and destination subscriptions.
  3. Stop the virtual machine that you want to move.
  4. Deallocate the virtual machine to ensure that no changes are made during the move operation.
  5. Create a snapshot of the virtual disk.
  6. Copy the snapshot to the destination subscription.
  7. Create a new virtual machine in the destination subscription and use the copied snapshot to create a new managed disk for the virtual machine.
  8. Attach the new managed disk to the virtual machine.

Given the options, the correct answer to the question is option D: "From Azure PowerShell, run the Move-AzureRmResource cmdlet."

This is because the Move-AzureRmResource cmdlet allows you to move an Azure resource from one resource group or subscription to another. This command can be used to move virtual machines, virtual networks, managed disks, and other resources.

When you move a virtual machine using this cmdlet, the virtual machine, virtual network interface cards (NICs), and managed disks are moved to the new resource group or subscription.

Option A ("Create a new virtual machine in Subscription2") is incorrect because it requires you to manually create a new virtual machine in Subscription2 and configure it from scratch, which is time-consuming and requires more administration effort.

Option B ("In Subscription2, create a copy of the virtual disk") is incorrect because it does not move the virtual machine itself, only the disk. This means that you will still need to create a new virtual machine in Subscription2 and attach the copied disk to it, which is more work than using the Move-AzureRmResource cmdlet.

Option C ("Create a snapshot of the virtual disk") is incorrect because it only creates a snapshot of the disk, which is a read-only copy of the disk that can be used for backup or replication purposes. It does not move the virtual machine to Subscription2, so you will still need to create a new virtual machine in Subscription2 and attach the snapshot to it, which is more work than using the Move-AzureRmResource cmdlet.