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

pic005

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)

pic001

IP Address range is 10.0.0.0/20
Gateway Subnet is 10.0.0.0/28
AD Subnet is 10.0.0.16/28

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”)

pic003

pic004

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

iron-man
If I didn’t share my template…

{
 "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
 "contentVersion": "1.0.0.0",
 "parameters": {},
 "variables": {
 "VNETName": "vnet001",
 "VNETID": "[resourceId('Microsoft.Network/virtualNetworks', variables('VNETName'))]",
 "VNETPrefix": "10.0.0.0/20",
 "VNETSubnet1Name": "GatewaySubnet",
 "VNETSubnet1Prefix": "10.0.0.0/28",
 "VNETSubnet1Ref": "[concat(variables('VNETID'), '/subnets/', variables('VNETSubnet1Name'))]",
 "VNETSubnet2Name": "snet-ad",
 "VNETSubnet2Prefix": "10.0.0.16/28",
 "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": [
 "[variables('VNETPrefix')]"
 ]
 },
 "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.

Advertisements