I had to move a VM from one VNet to another VNet, the first idea I had was to attach another NIC from the different VNet to the VM, making that primary and then removing the older NIC.
But when I checked that option in the portal adding for attaching a network interface got a bummer as the new NIC should be in the same VNet as the primary one.

To move the VM from one VNet to another VNet, you have two possible options:
- Create a snapshot of the VM disk and create another VM using that disk snapshot. Check this blog on how to do that.
2. Delete the VM and not the Disk and use this disk to create another VM.
STEP 1: Deleting the resources
The VM ‘test’ is currently on vnet1.

The first thing to do is deallocate the VM only, leaving it’s disk behind.

The resources that are created are VM, NSG (if you have one-to-one mapping of VM and NSG) and the NIC.
STEP 2: Creating another VM
To create a VM using the left out disks, choose the OsDisk and select Create VM.

After providing the name and size options in the first tab, you can add the additional disk in the disks tab and choose the network in the third. Previously the VM was in vnet1 now I will be creating it in VNet2

To summarize
If you need to move the VM from one VNet to another there is no direct way but this can still be done using the underlying storage for the VM.
One thought on “Moving a VM from one VNet to another in Azure”