Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Didn't think this was directly related to programming, so thought Superuser would be better than Stack Overflow....

Is it possible to add an existing Azure VM to an Azure Virtual Network if you didn't add it to the virtual network at the time of creation?

I can't see an option to change which Virtual Network the VM is connected to. Do you just have to do it at the time you create the VM, and if you don't do it then you will need to re-create the VM and delete the existing one?

Example of the scenario:

  • No VM's or Virtual Networks exist
  • I create a VM (VM1), there is no virtual network so it isn't added to one
  • Later I create a Virtual Network in Azure (Network1)

It is possible to create another VM (VM2) and connect it to the Virtual Network (Network1), but can I connect VM1 to Network1 or must I delete VM1 and re-create it to get it connected to Network1?

share|improve this question
    
Sounds more a question for Server Fault instead... –  icelava Oct 8 at 2:16

3 Answers 3

You can remove the existing VM and create a new VM with that same VHD, deploying it to the virtual network. But there is no method to move it into the virtual network once the VM is created.

When you remove an existing VM, the VHD for it remains and is registered as a disk in the portal. So when you create a new one you can just select that disk under My Disks in the portal to reuse it.

share|improve this answer
    
fyi After deleting my VM I had to wait a couple of minutes and/or CTRL-F5 the management portal before it would recognise the disk being there. Then I could create a VM from the VHD through New > Virtual Machine > From Gallery. –  Rory Aug 6 '13 at 12:57
    
+1 - And while this is a stupid pain in the butt and I don't understand why such a drastic measure is needed, it wasn't so hard or time consuming. –  uosɐſ Nov 29 '13 at 22:35

You should create the Virtual Network first, define the address space, then make sure the VM connected to the Network.

If you already create the VM, delete the VM but keep the disk. Then create the VM using the existing disk in the galery and make sure using the virtual network that you already defined.

share|improve this answer

If you need to move between subnets, follow this guide. No reason to delete the VM, Azure only just recently started to allow for VIP reservations. Vnets are another story.

http://msdn.microsoft.com/en-us/library/azure/dn643636.aspx

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.