Azure - Cloning Virtual Network

Janos Bukoczi 25 Reputation points

During a new network interface creation Azure clones existing virtual network and its subnets.

  1. Create resource group "rg1" and "rg2" in the same region
  2. Create a virtual network "vnet1" and one ore more subnets in "rg1". Use the same region as "rg1"
  3. Create a virtual interface, use the same region as "rg1", select existing "rg2" resource group, "vnet1" virtual network and one subnet. Select static private IP address assignment and type one IP from the subnet.

Azure will clone existing "vnet1" and its subnets with the same virtual network and subnet names, same address space and subnets.

How it's possible?

On review page there is no notification that virtual network will be cloned during virtual interface creation.

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,227 questions
0 comments No comments
{count} vote

Accepted answer
  1. ChaitanyaNaykodi-MSFT 23,991 Reputation points Microsoft Employee

    @Janos Bukoczi

    Welcome to the Microsoft Q&A forum.

    Based on my understanding from your question above. You have created two resource groups in the same region rg1 and rg2. You also created a virtual network named "vnet1" in rg1 in the same region. Now when you are creating a Network Interface in rg2 and have selected the "vnet1" from rg1 then same virtual network is created in rg2 with the same subnet name.

    Based on the observation above, as documented here the name of a virtual network must be unique within a resource group, but can be duplicated within a subscription or Azure region. So, creating a virtual network with same name and region in different resource group is possible and within scope.

    Now regarding your further observation above

    Azure will clone existing "vnet1" and its subnets with the same virtual network and subnet names, same address space and subnets.

    I tried reproducing the same scenario above, but it did not create same virtual network and subnet for me in rg2 and it successfully used the vnet from rg1 with the requested static private IP. I followed the documentation here to create a network interface.

    User's image

    Can you please validate if you selected the same options as above and still a new virtual network was created? if you used azure portal to create the network interface(NIC) before, can you please use AZ CLI commands to create the NIC and see if the issue persists. You can use the cloud shell to run the AZ CLI commands.

    Hope this helps! Please let me know if you have any questions. Thank you!

    ​​Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. msrini-MSFT 9,261 Reputation points Microsoft Employee

    Hi, You can create a virtual network interface only when you have a Vnet, subnet created in the first place. In your case, when you selected rg2 where the vnet is not present, you can create vnet and subnet from the same blade of creat network interface. Sometimes portal picks those ip ranges which you used to create previously. So the bottom line is if you want to create a vNIC, a Vnet and subnet needs to be created first. If not you can create it along with the creation of vNIC on the same blade.

    0 comments No comments