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 Azure DevOps Repos in your Azure Cloud Shell
- Restarting your Azure Application Gateway with PowerShell
- Renaming your repos in Azure DevOps
- Visual Studio Code keyboard shortcut to manage your code
- Using Azure ephemeral disks when provisioning VMs with ARM