Infrastructure as Code – Azure Resource Manager Templates

Infrastructure as Code – Azure Resource Manager Templates

Dev Ops, IaC, JSON, Automation

The above buzzwords are commonly used in IT today but what does it all mean?

The idea of automation is not new.  I think we’ve all been using BAT files and more recently PowerShell scripts to deliver a wide variety of activity levels on infrastructure. However, when automation met virtualisation, most programming languages, which natively talked together, has allowed IT to develop “code” and essentially orchestrate and deploy an entire infrastructure in minutes.

Which is ideal for those easily scalable solutions that need to be deployed fast.

So when an employee says “I need a server, or storage with a big data share, just for me” it is now easily achievable through the power of Automation in Azure. The need to provision, sign off the investment, speak to the SAN and network team etc is all in the past.

Written by

on

1 Jun 2017

Azure Virtual Machines (v2)

The new Azure VM’s compared to the old ASM model are incredibly intelligent and so much more powerful. They now feature a huge parallel deployment model, where you can add custom scripts for PowerShell, DSC, Chef, Puppet etc. These VM’s in Azure are constantly being upgraded by Microsoft, so you only get the best machine for the operation you want to run.

  • Massive and parallel deployment of Virtual Machines
  • 3 Fault Domains in Availability Sets
  • Custom URLs for Custom Script VM Extensions for VMs

Defining a template

How you define templates and resource groups is entirely up to you and how you would like to manage your solution. For example, you can deploy your three tier application through a single template, to a single resource group.

You can create multiple ARM Templates, for specific infrastructure resources. Fundamentally, you have a Virtual Network Resource Template and a VM template… these can be linked together using a nested format, or single templates, so you can re-use them again and again.

So what is JSON?

JSON stands for JavaScript Object Notation, this is an open-standard format.

While the name suggests it is derived from JavaScript, it can actually be read from and understood from most programming languages out there today.

The templates you see will are “Whitespace insensitive”, this means it doesn’t matter how many new lines of code you put in, how many spaces there are in the syntax, it won’t affect the actual functionality of that template. You can add those in as much as you want to make it easily readable for you as desired.

As you start to build out templates, you’ll see that it does look massive, but when you investigate further, it’s just lots and lots of new lines of code, with a single character on a particular line.

Tooling

There are various ways to Author your JSON templates, using Notepad++, Visual Studio Code, and then deploying ARM Templates using Visual Studio (any edition) or PowerShell, or now even through the Portal.

With the power of Azure Resource Manager Templates, you can author and deploy Resources into Azure within minutes.

By using this template approach, you can repeatedly deploy your solution throughout its lifecycle and have confidence your resources are deployed in a consistent state.

For an example scenario, you get into a situation where your now building multiple resources into Azure, and you need two VM’s, three VM’s etc, load balanced with Static IP’s, on Server 2016 etc. Realistically how long do you think it is going to take you to click through the portal or even create them on-premises.

This is where building ARM Templates will be perfect for that type of Solution, once you get the hang of coding these, it will become second knowledge.

Getting started

To get started with some basic ARM Template deployments, you can go to Github, it’s a public repository for tonnes of ARM templates available for you to instantly download and start authoring yourself. You can even deploy these templates straight from the website which will re-direct you into the Azure Portal.

Once you have got the basics of these template structure, you can then start to author and deploy your own custom templates, build various cloud environments, dev test etc.

Keep Up To Date – Join The Mailing List


Subscribe

  • PowerON, Stanley Harrison House, York, YO23 1DE
  • 0800 3029280
  • info@poweronplatforms.com

TRy Us for Yourself

Share on Facebook
Share on Twitter
Share on LinkedIn

Related blogs

two people at desk looking at code

AOVPN DPC V4.0 is Now Live!

Today we’re very excited to announce the release of AOVPN DPC 4.0 with support for Windows 11! AOVPN Dynamic Profile Configurator is now functional with