Reputation: 1585
I already have a resource group in azure that has a virtual machine and it is associated with a network interface to connect to a vnet in that group.
resource-group-1
-> virtual machine
-> network interface
-> vnet
-> other things ...
But now i created a second resource group which will have some resources and a vnet. I want to use for now, the same virtual machine that exists on resource-group-1
, so i created a network interface there:
resource-group-2
-> network interface 2
-> vnet 2
Now i want to connect the network interface 2 of resource-group-1
to the virtual machine in resource-group-2
.
I already tried, like the documentation says to stop the VM and going to Settings
, Networking
and Attach network interface
, but i don't seem to be able to select anything useful there.
It seems that some time ago, this changes could only be done through powershell. Another thing i saw is that we cannot change the vnet when adding a new nic to a VM. This might not be possible at all?
Currently, i guess the following options might make this possible
Upvotes: 1
Views: 3262
Reputation: 28204
It's impossible to add a new network interface that exists in the different VNet from the network interface currently attached to the VM to an existing VM. You can not add two NICs in different VNets to the same Azure VM. Refer to this.
If you want to move your azure VM and its NIC to another resource group, a simple way is to move a VM to another resource group. Read supported moving resources.
In addition, there is a Step-by-Step PowerShell Guide: How to Move Azure VM to a different Resource Group?
Upvotes: 2