How to move VM to a new Virtual Network in Azure Portal
Solution 1:
Moving VMs between different VNET is not supported. To move the VM to another VNET, the only solution for now is re-create the VM with the same vhd file.
To redeploy the VM with same vhd file, please try this template.
BTW, we are able to move the VMs between the subnets in the same VNET. It contains 3 steps:
- Get the VM (NIC) configuration
- Edit the VM (NIC) configuration
- Update the edited configuration
Here is a good step-by-step guide:
How to change Subnet and Virtual Network for Azure Virtual Machines (ASM & ARM)
Solution 2:
You can't move a VM to another Virtual Network without redeploying.
To redeploy a VM, I like this method, but here's Microsoft guide using Powershell. Just make sure to change the associated network interface for one within desired VNet.
Solution 3:
Although an old post now I'd like to list another solution I found recently when trying to figure out the same thing. It is possible to do this and automate the entire process using PowerShell. I found this excellent blog post which shows how to do it. Hope it helps!
https://think-like-a-computer.com/2020/02/06/azure-move-vm-to-another-vnet-powershell/