Thursday, 12 March 2015

How to change or add a virtual network to a virtual machine with Azure

A massive annoyance is that you are unable to switch virtual networks around on VMs i.e. you must define the virtual network initially when creating the VM - there is no way of adding or switching this afterwards!

Althoguh there is a hack and slash method to achieve this...
Firstly delete the VM you wish to change / add the virtual network too (although make sure you select "Keep Disks")!

Go to the disks tab and make sure that the disk is still present / not allocated to a VM. (Make sure you DO NOT delete them assosiated "Cloud Service" as well otherwise you won't be able to use the same IP address!)

Then we go to: New >> Computer >> Virtual Machine >> From Gallery >> Disk (select the disk from your old VM - your old disk CAN take upto 10 minutes sometimes to appear in the disk view - so be patient.)

Create the VM as usual - although make sure that you select the relevent Virtual Network under "Region/Affinity group/Virtual network" and also select the same "Cloud Service" that your old VM was using.

The only other drawback (apart from taking some time) to this method is that you lose your RIPE IP address allocation for the cloud service - but this shouldn't be a massive issue if you are using DNS.


Post a Comment