Skip to content

Personal Azure Resource Manager templates overview

Reading Time: 4 minutes

My personal Azure Resource Manager (ARM) templates overview is an follow up to my last post about studying for MCSD Architect certification in my last post here.

During this study I started using ARM templates in detail, and I believe the use of these templates can benefit people working with Azure or/and those studying for Azure related certifications.

In this post I will explain why I think that.

What are ARM templates?

Now you might be asking yourself what are ARM templates? Basically, they are JSON files you can use to define how an environment is structured. After you have created them you can then deploy the environment to Azure.

I truly believe ARM templates are great because it makes deploying infrastructure faster. For instance, with one ARM template you can design and deploy a basic infrastructure environment.

ARM templates are part of the Infrastructure as Code methodology that has come about in recent years. Which is where you are encouraged to deploy environments using code instead of the traditional manual way.

Microsoft rate ARM templates so highly they are used as part of at least one MPP course on EDX. Which I discussed in a previous post about study tips here.

Benefits

Using templates to deploy can save a lot of time, you end up with reusable code and guarantee more consistency.

Previously I had a discussion with somebody who wanted to do manual deployments in the cloud. I know some people prefer to build manually because it’s the way they have done it many times in the past.However times are changing and so are working methods.

Deploying with ARM templates is way more practical and reduces the chance of human error. Deploying is a lot faster because you have everything available in a cloud-based solution, only use one file and a PowerShell command.

I remember having to wait months for various pieces of infrastructure to be ordered and configured. Now I can grab a coffee whilst a complex environment is being deployed.

In addition, you can also put these templates in source control or use it as part of a deployment pipeline. For example, you can use these within Azure DevOps.

Different environments

Those of you who wish to deploy a full Data Platform infrastructure the same way to different environments might find these very useful. For instance, you can use the same template to create dev, test and production environments in Azure.

You can then use parameters to define the differences between the deployments to the different environments. Either during deloyment or by using a parameters file.

For example, which subnets and naming conventions to use for each environment. That way you can guarantee all the environments are truly deployed the same way.

How to create them

To create ARM templates, you usually use an IDE like Visual Studio Professional. You can also use Visual Studio Code instead to create them as there is a snippet available.

Because the file is in text format, you can use a text editor instead if you feel comfortable doing so.

Available templates

Now there are templates that are available for you to use online as a starting point. Which you can use to help develop your environment.

In addition, if you use Visual Studio you can create a new project along with the templates that are available within Azure and GitHub.

Be aware though that in some versions of Visual Studio you can occasionally experience problems if you attempt to open the templates from within GitHub.

Idempotent

Another thing about deploying environments this way is that they can be idempotent. Which means that if something happens to an item you have deployed you can rerun the template again and it will only add the components that are different.

Now, there are two things you should remember about something being idempotent. Firstly, never mispronounce it when explaining it to others, otherwise you could end up in an embarrassing situation.

Secondly, be aware that if you introduce custom Powershell or DSC to an ARM template then you can prevent your template from being truly idempotent.

Deployment

You can deploy ARM templates using various methods. For instance, you can do it within the Azure Portal itself. It tends to be more reliable this way but realistically you probably don’t want to have to constantly add and remove environments in the portal.

In fact, during development you can deploy them directly within Visual Studio. You can also deploy them from the command line. For example, using either Powershell or the Azure Client tool.

In fact, my preference has been to use PowerShell. However, recently whilst studying for a Microsoft Professional Program I have been deploying using Visual Studio more. I’m easy going either way to be honest.

Further learning

It’s worth keeping an eye out online for changes as they do update the capabilities of ARM templates over time. For instance over the years they have added conditional logic and support for managed disks. You can read more about Azure templates from Microsoft in detail here.

Pluralsight also have an excellent Azure Resource manager deep dive course which covers ARM templates in detail as well. If you have a Pluralsight subscription then you can view it here.

In addition, if you have Azure credit thanks to a Visual Studio subscription then you can follow along and create the objects in this course. Just remember to do housekeeping inbetween viewing and delete the objects to avoid using too much credit.

Final word

Whether you work with SQL Server or in another operations role, when you are going to do deployments in Azure I highly recommend that you look to master using ARM templates.

I’d love to hear from those of you who use ARM templates as curious how others use them. For instance, what innovative things you use them for and how you rate them?

In addition, I’m also keen to hear how others deploy to Azure without using ARM templates as curious how other methods are being implemented.

So please feel free to add a comment about your experiences to share with myself and others.

Personal Azure Resource Manager templates overview
Published inAzure

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *