Deploy a basic Virtual Network in ARM Template Part 1

I’m doing a multi part blog series on a basic ARM JSON deployments, so you can deploy a Cloud Environments in Azure

Part 1 – Virtual Networks
Part 2 – VM Deployments


Part 1 – Virtual Networks

Anyone that works with Azure (or AWS, vCloud etc) and has an infrastructure background, you know that first rule of thumb, is always build out your Networks first.

If you just chuck any old resource up there with a Vnet attached, you’re kind screwing everything up for future deployments (if it so happens you have production stuff you just launched into the Cloud without planning your networks)

If it’s for Dev/Test and you’re not having a Site to Site VPN, then you can ‘chuck’ anything up there, but if you’re seriously planning on utilising Azure for future deployments to offload your production VMs, Apps etc, then i would seriously consider sitting down, Planning, Designing and carving out your Virtual Network

I’ve designed this template so when you come to deploy multiple resources in Azure using ARM Templates, you don’t have to deploy a Vnet in each template, you can just reference the Vnet ID

So, we start off by having a simple Vnet (Virtual Network)


IP Address range is
Gateway Subnet is
AD Subnet is

I’m only allocating a small amount of addresses (yours can and may be different)

Within the Vnet template, you’ll see that it’s pretty basic, 1 Virtual network Resource, no parameters because everything is a variable (which can be changed to fit your environment)

pic002After deploying the template it will succeed, and you’ll see your Vnet in Azure Resource Manager (NOTE: the Virtual Network is “vnet001” and the Resource Group is “RG-Vnet”)



That’s a simple JSON template, deploying a  virtual network in a single resource group…. easy eh?
I wouldn’t be a hero

If I didn’t share my template…

 "$schema": "",
 "contentVersion": "",
 "parameters": {},
 "variables": {
 "VNETName": "vnet001",
 "VNETID": "[resourceId('Microsoft.Network/virtualNetworks', variables('VNETName'))]",
 "VNETPrefix": "",
 "VNETSubnet1Name": "GatewaySubnet",
 "VNETSubnet1Prefix": "",
 "VNETSubnet1Ref": "[concat(variables('VNETID'), '/subnets/', variables('VNETSubnet1Name'))]",
 "VNETSubnet2Name": "snet-ad",
 "VNETSubnet2Prefix": "",
 "VNETSubnet2Ref": "[concat(variables('VNETID'), '/subnets/', variables('VNETSubnet2Name'))]"
 "resources": [
 "name": "[variables('VNETName')]",
 "type": "Microsoft.Network/virtualNetworks",
 "location": "[resourceGroup().location]",
 "apiVersion": "2015-06-15",
 "tags": {
 "displayname": "[variables('VNETName')]"
 "properties": {
 "addressSpace": {
 "addressPrefixes": [
 "subnets": [
 "name": "[variables('VNETSubnet1Name')]",
 "properties": {
 "addressPrefix": "[variables('VNETSubnet1Prefix')]"
 "name": "[variables('VNETSubnet2Name')]",
 "properties": {
 "addressPrefix": "[variables('VNETSubnet2Prefix')]"
 "outputs": {}

There is no Parameters file because everything is referenced within the Variables.


One thought on “Deploy a basic Virtual Network in ARM Template Part 1

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s