How to Change the Vnet of a VM

Biswajeet Kumar 46 Reputation points
2020-10-19T04:08:55.157+00:00

Hi,

We have created multiple Vnets in Azure. They can communicate with each other using Virtual Network Gateway.We need to change the Vnet of the VM to another one.

How do we do that without deallocating or deleting-recreating the VM?

Thanks

Azure Virtual Network
Azure Virtual Network
An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.
2,205 questions
0 comments No comments
{count} vote

2 answers

Sort by: Most helpful
  1. Andreas Baumgarten 98,626 Reputation points MVP
    2020-10-19T06:12:05.273+00:00

    It's not possible to switch a VM between subnets/vnets without deallocating/deleting-recreating.

    Easiest way:

    • Delete the VM but keep the OS Disk.
    • Deploy a new VM in the new subnet and use the still existing OS Disk.

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten

    9 people found this answer helpful.

  2. Kasun Rajapakse 351 Reputation points
    2020-10-19T06:12:37.897+00:00

    Hi,

    Why do you create virtual network gateways to connect all the VMs. We can use peering for this it's more easy and reliable. Its not possible to change the VNET without deallocating the VM and deleting the VM.

    https://4sysops.com/archives/move-an-azure-vm-to-another-virtual-network-vnet/

    Follow the above guide

    1 person found this answer helpful.