ARMtemplate to create a VNET with 4 subnets and 4 routing tables

This blog is about automating a network deployment. This particular deployment creates a VNET with 4 subnets and 4 routing tables which are automatically assigned to the according subnet. The routing tables are configured with the 3 rules each, which point to the Network Virtual Appliance which is your firewall. The firewall deployment will feature in another blogpost.

First I would like to show you the High Level Design for this deployment:

The resourcegroup for this deployment is not in the ARM template so we need to create this:

Log on to Azure in Powershell, if you haven’t done this before you need to install the Powershell module. Run this command in an elevated Powershell session:

This is the command to log on to Azure in Powershell:

Now create the resource group:

This is the code for the complete deployment. Save this as a “.json” file:

To use your own names for the resources deployed go to the “variables” section in the code.

For the VNET name change the variable: “VirtualNetworkName”.

For the VNET prefix change the variable: “VirtualNetworkPrefix”.

For the Subnet names change the variables: “subnet1Name”, “subnet2Name”, “subnet3Name”, “subnet4Name”.

For the Subnet prefixes change the variables: “subnet1prefix”, “subnet2prefix”, “subnet3prefix” , “subnet4prefix”.

And finally for the routing table names change the variables: “routeTable1Name”, “routeTable2Name”, “routeTable3Name”, “routeTable4Name”.

Now run the file in the Powershell session where you are connected to Microsoft Azure:

The deployment is now completed!

If you have any questions or trouble with the deployment, don’t hesitate to ask!



Related Posts

Leave a Reply