Step-by-Step guide: How to Move VM to different VNET on Azure RM

Today I am going to show you how to move/migrate VM to a different VNET.

First of all, if you suddenly need to move VM to a different VNET it means that you haven’t planned accordingly. Or, it might be that requirements have changed, but VM is already up and running.

Anyway, there is no straight process to move VM to a different virtual network.

In the screenshot below I have a Win2016 VM deployed to Marty-TestVM-vnet virtual network.

VNET is configured to use default address space, which is 10.2.0.0/24. Subnet – default 10.2.0.0/24

What I am going to do is, create Azure Backup and Recovery Services, backup a VM and will restore VM to the VNET with correct IP Address Space and Subnet.

Let’s start!

First, click New and type in the search box Backup and click on Backup and Site Recovery (OMS)

Fill up the data. Keep in mind that Recovery Services Vault must be in the same location as items you want to backup. In my case it is UK South.

After Recovery Services Vault is created, we need to add our Azure VM to Backup vault. Simply click on the Recovery Vault instance. We see that Monitoring, Backup and Site Recovery sections do not indicate any activity. We need to add our VM  to the Backup list. Click +Backup ans another blade will expand. We choose Azure as the source of the workload and Virtual Machine as the item we want to backup. Click OK

In the second step we have to choose the default policy or create new one. In this case we leave default and click OK

In the last step it will list all the available VMs in that region where our Recovery Services vault is created.  Choose the VM(s) you want to backup and click OK. If you need to add any VMs later on, just repeat the same steps and click on the VMs you want to add to your Recovery Services vault.

After you get all 3 steps marked with the green check, click Enable backup.

Now on the Recovery Services vault blade, Overview section you will see that Backup Items has changed to 1.

Because we need  backup VM straight away and don’t want till the policy will kick in, we need to initiate it manually. Click on the Backup Items as per image above, click on Azure Virtual Machine instance, VM and click Backup Now.

Now on the Overview section, under the Backup jobs, you will see that there is a job in progress.

Click on it and it will take you to Backup jobs blade where you can check and refresh the progress.

While the VM backup is taking care of, we need to take care of where we want to restore the VM. In this case we need to create a VNET and subnet accordingly.

Go to New, type virtual network and from the market place choose Virtual network. Let’s give it a name and put it under 172.20.9.0/24 address space. Click Create.

Now when backup has been completed we need to restore VM. Click on Backup items, choose Azure Virtual Machine, select a VM you want to restore and click Restore VM.

In the first step, you need to choose the restore point. In this case, we have only one. If there is no special need to restore older snapshot, choose the latest one and click OK.

In step 2 we need to provide the rest of the details. We have to choose VM name, Resource Group where we want to restore it to, choose predefined Virtual Network. We choose AnotherVNET that we have created earlier and Corp-Subnet. Click OK and Restore.

You can check the progress of VM restore in the same Overview blade, under Backup Jobs.

After VM restore has been completed, let’s check VM and network properties.

Now we can decommission our old VM and that is it.

5 Comments

    1. Existing Network Security Groups can be assigned to other subnets in different Vnets. Be careful to reconfigure the target IP settings if you have set them to point to the specific private IP of the old VM.

  1. First of all, the name doesn’t disappoint! Thank you for putting together such a detailed, easy to follow walkthrough for how to do this!! I’m still trying to figure out a way to make it clear to Microsoft that being able to make a VM from one Vnet to another would be an INVALUABLE feature that a lot of us would find useful. All that being said, I’ve gone through the process of using this walkthrough to move 2 VMs out of their existing Vnet to one where our Build machine is. Unfortunately, this process is not a quick one: took 3 hours to do the backup & almost another 3 to restore. Before I go any further, I will gladly take 6 hours to have the ability to clone & recreate with minimal input from us over 3 hours of having to manually recreate the VM (deploy a blank VM, load all the applications, install updates, copy over files, …etc). My question is: Is there a quicker way to do this? I ask because one of my colleagues told me we should be able to copy the .vhd from the VM, create a new VM in the Vnet of our choice, & attach the original .vhd to the new VM. Is this true? Thanks again for all you do!

    1. @Dacve How about moving/changing from different VNET? Because as the site(you linked) says
      IMPORTANT: There is a strict requirement here: you can only change subnet if the new one is in the same VNET as the old one.

Leave a Reply

Your email address will not be published.