4

Can someone let me know how to move a VM from one Virtual Network to another. In the image, I would like to move the VM webtestnic-backend-.... from Virtual network 'webtestvnet-arrmb7u3eu35o to my VirtualNetork.

azure

Can you let me know how to do that?

Cheers

Carlton

3 Answers 3

5

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:

  1. Get the VM (NIC) configuration
  2. Edit the VM (NIC) configuration
  3. 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)

1
  • I guess it is now supported. See answer by @Mucker
    – sirdank
    Feb 18, 2020 at 13:38
1

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.

2
  • Hi Bruno, thanks for responding. Looking at your powershell scripts, it doesn't appear to assigning the interface to a virtual network. However, it does assign the interface to a resource group. Don't I need to assign the interface to both the Resource group as well as the virtual network?
    – Carltonp
    Nov 10, 2016 at 18:14
  • I removed the cmdlets because I made a double check and realized you really can't move the VM to another Virtual Network without redeploy. You can change a NIC that is using a different configuration, but it still need to be in the same VNet. I used pipe in those cmdlets to avoid retyping some of the parameters like vm name. Nov 10, 2016 at 18:18
1

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/

2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .