There are many reasons why you may need to duplicate an existing virtual network, and, of course, the reasons will vary. In my case, my customer asked to create a “bubble” network where they want to replicate the same layout and IP ranges associated. I went ahead and created a script to do exactly that, making sure that all IP ranges for the virtual network and subnets are replicated to a second virtual network. The script for cloning an Azure virtual network is simple, and you can get access to the source here. We need to provide the virtual network that we want to clone, the destination resource group and a name for the clone. (This name will be added as a suffix of the cloned virtual network.)
The result will be a brand new virtual network with the configuration at the IP level of the original virtual network.
So, as you can see, cloning an Azure virtual network is a snap.
More Quick Tips articles
- Fixing Azure Key Vault when moving to a different tenant
- Restore Azure Key Vault using just two PowerShell cmdlets
- This overlooked feature in Visual Studio Code can speed release time
- Enabling Front Door managed certificates in Azure: Status update
- How to quickly check the status of all your Azure services