It’s a simple enough operation (PowerShell) to move a virtual machine to a different subnet within a virtual network. But what if you want to move the virtual machine to a different virtual network? That’s a bit more complex to do because you cannot just lift the VM to another network.
Instead you will have to:
1: Delete the virtual machine, choosing to keep the attached disks. Doesn’t Azure Backup of Azure Virtual Machines sound like a good idea right now? Go do that first
2: Create a new virtual machine from the existing disks. The above deletion process keeps the original disks, and deletes the meta data of the VM. You are now going to create new meta data using the remaining disks. This is like moving the hard drives from one broken server to a replacement server. Go into the wizard and instead of selecting a template, choose your old disk. Make sure you know which one it is first – the name of the old VM (FS1 in this case) is usually in the file name.
3: Complete the wizard and select the new virtual network. If this is a new network/application then you probably will have to create a new cloud service too.
4: Attach any data disks. If the old VM had any data disks then they’ll need to be reattached. Shutdown the VM and attach the disks.