Recently I had to move a couple of Windows Azures Virtual Machines from West Europe to Southeast Asia. This process wasn’t as easy as expected, so therefore I’m sharing the steps on how to move a Virtual Machine to a different data center.
Move Azure VMs between datacenters
The most important part is being familiar with Windows Azures Virtual Machine setup and terminology.
Virtual Machines:
A Virtual Machine in Windows Azure consists out of a computing and storage component (system disks VHDs). The compute instance cannot be moved and therefore requires re-creation within the desired region/affinity group/virtual network.
VM Storage:
You can find the system disks within a storage account, which is bound to a region/affinity group/virtual network. As with the computing instance, you cant alter the location of a storage account. Therefore, you will need to transfer the VHD files from one account to another.
Unfortunately, this isn’t possible within the current portal, but the steps below will guide you through the process.
Starting the Virtual Machine “Move” process
Step 1 – Capture Virtual Machine settings
First of all, you will need to capture the settings of the target Virtual Machine. You can’t move the computing instance across data centers; as a result, it’s required to re-create the Virtual Machine instance. Gathering the information can be performed via the Management Portal or just by executing the following PowerShell commands.
Besides, you will need to keep track of which VHD file needs to be copied in step 5 format: http://{storage_account}.blob.core.windows.net/{container_for_vhds}/{file_name}.vhd)
Step 2 – Stop and delete the computing instance.
Now that the Virtual Machine details are captured, it’s safe to stop the instance and delete the Virtual Machine and Could Service. Deleting a Virtual Machine will only remove the computing instance. The system disks will remain within the storage container.
Step 3 – Create a destination storage account.
The next step will be the creation of a new storage account located within the desired region. The following table lists the possible locations:
North Central US | South Central US |
East US | West US |
North Europe | West Europe |
Southeast Asia | East Asia |
Step 4 – Copy the system disk’s VHD to the new storage account.
We are now ready to start the BlobCopy operation. You can only do this operation within PowerShell and the Windows Azure REST API. I’ve included the PowerShell version below.
Note: just make sure to provide the storage account name and storage key for both the source and destination. In addition, it’s required to specify VHD file name as gathered in step on and provide a new VHD name for the destination (which can be identical)
Step 5 – Get some coffee and a magazine.
It will take some time to transfer the data. You can keep track of this process using the following PowerShell script:
Or abort the operation:
Step 6 – Create a new Windows Azure Virtual Machine based on the copied VHD
After the data transfer has completed, you should be able to create a new Virtual Machine. Using the portal, select New » Compute » Virtual Machine » From Gallery » My Disks then select your VHD.
Or using PowerShell
NOTE: Please note that Azure is changing almost on a weekly basis therefore the information in “Move Azure VMs between datacenters” might not be up-to-date.
Recent Comments