Trending on MSDN: Unable to change Subnet or add new NIC of new Subnet in new Resource Group

Micah McKittrick 946 Reputation points Microsoft Employee
2019-10-29T19:35:24.443+00:00

I have a VM in an old Resource Group with Address Space 192.168.0.0/16 and subnet as 192.168.2.0/24. My plan is to move the VM to different Resource Group with a different Subnet of 192.168.3.0/24 so it gets an ip of 192.168.3.5 as per the subnet.

I've created a new Resource Group with Address space 192.168.3.0/24 and subnet as 192.168.3.0/28. After that, I moved VM and its associated NIC and the NSG. I assumed that it will get New IP address range of 192.168.3.0. But the VM's NIC is still showing the old VNET is associated to it on the portal.

I tried following steps to get new Subnet IP's.

Created New NIC of new Subnet with New NSG but cannot attach the same to moved VM. There is no option to change the VNET.

I moved that VNET to new RG but I am still not able to add another NIC from Different VNET.

The Only Solution I see is to Create a new VM in new RG with a new NSG and then SWAP the OS Disk. Or Backup the VM from old VNET and Restore the VM to the new VNET.

Sourced from MSDN

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
6,978 questions
0 comments No comments
{count} vote

Accepted answer
  1. olufemia-MSFT 2,861 Reputation points
    2019-10-29T21:12:01.923+00:00

    Welcome to the Microsoft Q&A (Preview) platform. Happy to answer your questions.

    When you move the VM to another resource group, the VNET is not changed. Your VM still connected to that VNET where it is initially deployed.
    Resource Group is just a container where you can deploy resources. Those resources can be in the same region or may be of different region. But in your case when you tried to change the VM to a different Resource Group, your VM is still linked to the same VNET and hence you are not allowed to attach NIC which is from a different VNET.
    As you mentioned, the only way is to delete the VM and create a new VM in different VNET in different RG as you desired.

    Sourced from MSDN

    1 person found this answer helpful.
    0 comments No comments

3 additional answers

Sort by: Most helpful
  1. AHMED ISMAIL GOMAA BAKIR 906 Reputation points
    2022-05-05T21:57:27.973+00:00

    Resource Group is just a container where you can deploy resources. Those resources can be in the same region or may be of different region. But in your case when you tried to change the VM to a different Resource Group, your VM is still linked to the same VNET and hence you are not allowed to attach NIC which is from a different VNET.
    As you mentioned, the only way is to delete the VM and create a new VM in different VNET in different RG as you desired.

    5 people found this answer helpful.
    0 comments No comments

  2. Vineet Kumar Gupta 161 Reputation points
    2022-04-13T10:04:15.067+00:00

    Vnet and subnet will be always same .

    1 person found this answer helpful.
    0 comments No comments

  3. Hanan Ali Ibrahem Roffa 81 Reputation points
    2022-05-06T03:22:02.857+00:00

    Resource Group is just a container where you can deploy resources. Those resources can be in the same region or may be of different region. But in your case when you tried to change the VM to a different Resource Group, your VM is still linked to the same VNET and hence you are not allowed to attach NIC which is from a different VNET. As you mentioned, the only way is to delete the VM and create a new VM in different VNET in different RG as you desired.

    1 person found this answer helpful.
    0 comments No comments