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!).

image

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.

image

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.

image

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.

image

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.

image

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.

image

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.

image

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.

image

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.

image

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.

image

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.

image

And there you have your Virtual Machine now moved to another Virtual Network. See you again soon!

Comments (17)

  1. Matt Watson says:

    This is great. I was trying to figure this out. Now Microsoft, please make a way to automate this!

  2. Andrew Strasheim says:

    One thing you can do is to delete the cloud service right after you remove the VM.  This will then let you *reuse* the DNS name you had used previously.

  3. Juan Felipe Betancur Uribe says:

    Great article, very useful … Microsoft should provide an easy way to move VMs between Virtual Networks.

  4. Sriram Iyer says:

    Thank you. This is a good article. Solved my issue.

  5. Jesse Brannon says:

    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,

    Jesse

  6. David says:

    Thanks, very clear and works great

  7. Rick says:

    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.

  8. Sujit Karpe says:

    Great work Walter. It solves my problem.

    Thanks.

  9. David Barkol says:

    Thanks, Walter!

  10. Vin says:

    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?

  11. Chris Huffman says:

    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.

  12. jordito says:

    Great post, you're the one !

  13. eeneb says:

    Flawless… even re-added all the disks in a striped array, no problems at all.

  14. Steve Valente says:

    I'm a little late to the party, but this worked great for me as well.  Thanks Walter

  15. Vincenzo says:

    This MUST be automated.

  16. Andres Concha says:

    Excellent information, thank you! Now I can move some virtual machines to the Brasil location

  17. c_altair says:

    WARNING: Files in temporary storage area (drive D:) will be lost.

Skip to main content