Introduction to Azure Resource Manager Templates for the IT Pro


The Problem

Conflict between software development teams and IT operations is familiar to many of us.

As IT professionals we are often faced with support tickets for applications that are:

  • Sluggish
  • Don’t install
  • Randomly stop working

This could happen randomly, or more commonly occurs after an application update. Have you ever escalated an issue to the application developers or vendor and had a reply the lines of “You have installed it incorrectly” or “Your hardware is incorrectly configured? It a situation that I have been in a number of times in the past and the resolution to the conflict is often a painful process.

Differences between the environment that the application was developed and tested in (DevTest), and the production environment are often to blame. It is often the case that the infrastructure that the application has been deployed into is configured differently to the DevTest environment. Even if when an application is initially deployed all works well, configuration changes made to the production environment are often to blame.

image

The Solution

To alleviate the issues we need to ensure consistency between the DevTest and Production environments. We can do this by creating a template that defines the environment. This template is then deployed along with the application to ensure consistency. This process is knows as Infrastructure As Code.

image

Azure Resource Manager Templates

Microsoft Azure is available in the Azure public cloud and will soon be available in your datacentre via Azure Stack (in preview at the time of writing). Infrastructure environments can be deployed to both Azure and Azure Stack using Azure Resource Manager Templates, commonly called ARM Templates.

I want to make clear that the intention of this blog post isn’t to teach you how to author ARM templates, but to provide IT infrastructure professionals with a basic understanding of what an ARM template is, what an ARM template contains and how you might want to to deploy ARM templates. There are many excellent resources available that I will provide links to that provide far more in depth information.

What’s in an ARM Template?

An ARM template is written in JSON (JavaScript Object Notation) which is of a similar concept to XML. Within the JSON file there are a number of sections:

There are three parts of the template that are the key to what an ARM template does:

Parameters
Parameters are values that need to be provided when a template is deployed and enable customisation. Examples of parameters could be the region that the template will be deployed into, server names, network configuration or passwords.

Variables
Variables are values that are specified once within the JSON file and can be used multiple times within the template. This means that when a value needs changing it only needs adjusting in a single place. Variables can get their value from a parameter.

Resources
The most interesting part – it defines what resources will actually be deployed to Azure. This could be storage, networks, virtual machines, database servers, load balancers and more.

Configuration of servers

Once servers are deployed they need configuration. Without configuration they are no use to anyone. To ensure each time the template is deployed servers are configured in a consistent fashion we carry out the configuration in an automated fashion. This is commonly known as Configuration as Code. Examples of configuration steps might include:

  • Installing and configuring server roles such as Active Directory, IIS
  • Deploying and configure software packages
  • Modify file security and registry entries

We can add a special resource called an extension to a virtual machine to carry out the configuration once it has been successfully provisioned. There are a range of extensions available to assist with configuration. PowerShell DSC, Chef and Puppet are technologies that are commonly used.

Deployment of an ARM template to Azure

Although as an IT professional you might not be able to create an ARM template from scratch (well not yet anyway) you do need to know how to deploy them. ARM templates can be deployed to Azure in a number of ways:

  • Azure PowerShell
  • Via the Azure Portal
  • Azure CLI
  • Rest API
  • Release Manager within Visual Studio Team Services

As the deployment is likely to be part of an automated process deploying ARM templates using PowerShell is a good option, or if you are working with developers using VSTS give Release Manager a try.

Quick Start Gallery

If you are new to ARM templates I appreciate there may be many new things to learn. I don’t expect you to go and start authoring your first ARM template from scratch – feel free, but your JSON skills are likely better than mine!

Instead I would recommend visiting the Azure Quick Start Gallery, https://azure.microsoft.com/documentation/templates/,  this is a library of community submitted ARM templates. Examples include:

  • Create a HA SharePoint Deployment
  • Create a Remote Desktop session collection

Within a few clicks you can deploy your chosen template to your Azure subscription. All the quick start templates are stored in source control, on GitHub. You can follow the links to GitHub to view the JSON files that have been used to create the deployments. Just ensure that if you are testing things out you don’t leave the services running and use up all of your Azure credit.

Authoring your own ARM Template

If you do wish to construct your own ARM template where do you start? I’d highly recommend starting with somebody else’s quick start template as explained above and building upon it. As an editor I use Visual Studio Community Edition – https://www.visualstudio.com/products/visual-studio-community-vs.aspx , the great thing about this is that it is FREE and provides features to edit ARM templates.

Next steps:

If you want to learn more about Azure Resource Manage Templates I recommend the following resources:

Deploying ARM templates

Authoring Azure Resource Manager Templates

Want to become an expert?

These resources go into more depth, will require some investment of time, but are highly recommended.

Comments (1)

  1. Darrick West says:

    Thanks for compiling this information. You answered the question I had about configuring a VM after its been provisioned via an ARM template.

Skip to main content