Moving a Windows Azure Virtual Machine from one Virtual Network to Another
Today I was trying to find an easy way to move a virtual machine from one Virtual Network to another, but wasn’t successful. So I played around until I figured it out, and thus the next time someone (such as myself) searches for a solution, they will find it here! This will be fairly quick once you know what to do. Below, I have a virtual machine named w2k8-02 that I want to move from the Virtual Network named p2stest to the Virtual Network named scomp2stest (and yes, I am doing some experimenting with SCOM 2012 and Point-to-Site VPN connections, but that is for another time!).
Let’s go to the Virtual Machines page and locate your virtual machine, as seen below. Select the arrow, which takes you to the detail page for the virtual machine.
The virtual machine detail page should land on the Dashboard tab. Note the OS disk name on the lower part of the page, as seen below. You will need this name when you attach the disk to the new virtual machine we will create.
Now, return to the virtual machines instances page, as seen below. Select the virtual machine you would like to delete (to the right of the name so you won’t go to the detail page), and then select the Delete button on the lower toolbar. This will not delete the underlying disk of the virtual machine, which we will see in just a moment.
Once you receive verification in the status bar that the virtual machine has been deleted, select the Disks tab, as seen below. Locate the virtual machine disk name that you noted earlier, and verify that it no longer has a value in the Attached To column.
We are almost ready to create the new virtual machine, but you must now wait several minutes before attempting to reuse the disk, as putting it back in the disk pool takes some time to process. On the bottom left-hand corner, select the “ + NEW” button, then Compute | Virtual Machine | From Gallery, as seen below.
You will now see the Create a Virtual Machine wizard. Select the “MY DISKS” tab to the left. If you do not see your disk, then you need to exit the wizard and wait a few more minutes. Once you do see the disk, select it and go to the next page.
On the Virtual machine configuration page, give the virtual machine the same name as before, or another name if you so desire. Go to the next page.
On the Virtual machine mode page, provide a unique DNS name, as you will not be able to use the previous DNS name since it is still marked as in use. In the Region/Affinity Group/Virtual Network dropdown, select the desired Virtual Network that you would like to move your virtual machine to.
On the Virtual machine options page, select an availability set or create a new one as desired. Select the final check mark to complete virtual machine creation.
Once the virtual machine has been created, go to your Virtual Network and verify in the dashboard that your virtual machine is there, as seen below. I have moved my virtual machine named w2k8-02 from p2stest to scomp2stest successfully.
And there you have your Virtual Machine now moved to another Virtual Network. See you again soon!
Comments
Anonymous
June 08, 2013
This is great. I was trying to figure this out. Now Microsoft, please make a way to automate this!Anonymous
June 26, 2013
The comment has been removedAnonymous
July 29, 2013
Great article, very useful ... Microsoft should provide an easy way to move VMs between Virtual Networks.Anonymous
August 23, 2013
Thank you. This is a good article. Solved my issue.Anonymous
September 29, 2013
Thank you for the article, I wonder if anyone has seen the issue I am experiencing though. I have done exactly as you suggested and have verified that the virtual network has been changed for the VM and that it appears under the network section. The issue now is that I am unable to access the VM over RDP at all. It tells me that my login credentials failed. I have tried both by selecting connect from the Azure Dashboard as well as trying from our corporate network and the internal VM's IP since I have a S2S VPN configured. Both ways have the same result. If I follow your steps again and move the VM back to how it was, I am again able to RDP into the VM. Any ideas? Thanks, JesseAnonymous
October 08, 2013
Thanks, very clear and works greatAnonymous
October 11, 2013
I deleted the vm and the associated cloud service, but the disk says it's still attached to the vm, so I can't create a new vm using it. Is there a way to break the association? Thanks for the help.Anonymous
October 11, 2013
Great work Walter. It solves my problem. Thanks.Anonymous
October 29, 2013
Thanks, Walter!Anonymous
November 01, 2013
What about the Storage Devices? Will they get moved to the new Virtual Network and its Storage Service? Also, will the he namespace be preserved, and if not is it possible to preserve it? This includes the netbios name being preserved if possible too?Anonymous
December 10, 2013
To those that delete your VM and your hard disk still says that it is attached to the VM and/or your OS disk doesn't show in the Gallery... Wait about 5-10 minutes after you delete your VM. Even though Azure says your VM is deleted it apparently takes a little longer to release the disk resources.Anonymous
December 10, 2013
Great post, you're the one !Anonymous
February 04, 2014
Flawless... even re-added all the disks in a striped array, no problems at all.Anonymous
February 24, 2014
I'm a little late to the party, but this worked great for me as well. Thanks WalterAnonymous
April 30, 2014
This MUST be automated.Anonymous
May 01, 2014
Excellent information, thank you! Now I can move some virtual machines to the Brasil locationAnonymous
May 15, 2014
WARNING: Files in temporary storage area (drive D:) will be lost.