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
- Using location in a consistent way in your ARM template parameters
- Using environment as variables in your Azure DevOps pipelines
- Removing Log Analytics with the soft-delete option
- Using conditions in ARM templates when deploying infrastructure-as-code
- Monitor your Azure VM from your mobile device by scanning a QR code