Enabling DevOps with Azure ARM

Enabling DevOps with Azure ARM

Lately I have been working more closely with Azure Resource Manager (ARM) on a DevOps project and wanted to share a few quick tips on working with ARM templates. If you have not used ARM yet, then head over to this page for an overview. Also, here is a excellent introductory blog post about Azure ARM.

In my own words, I would simply say that Azure Resource Manager (ARM) is a way to automate the deployment of your infrastructure and applications. If you are doing any kind of DevOps in your enterprise, then you quickly realize the power of ARM for automating your entire deployment pipeline. However, the other advantage of using ARM is that you can also centrally manage the source code that makes up your entire infrastructure. If you are using Visual Studio 2017, then you also have the advantage of access to the ARM templates.

Working with ARM Templates

In order to launch the ARM templates from Visual Studio 2017 you just have to select Create a new project from the VS2017 File menu and then enter 'azure resource' in the template search terms and VS2017 will fetch the ARM templates for C# and VB for you:

Visual Studio 2017 ARM Template Picker

The list of the templates that are supported out of the box in VS2017 is pretty extensive:

Visual Studio 2017 ARM Templates List

There are templates for Web Apps + SQL, Service Fabric and even Docker! If the basic templates available in VS2017 are not what you are looking for, you can also head to the Microsoft Azure Quickstart Templates website where you will find a wide variety of ARM templates:
https://azure.microsoft.com/en-us/resources/templates/

Azure Quickstart Templates

Visual Studio 2017 Support

Here I am choosing a five-node Service Fabric Cluster ARM template:

Service Fabric Cluster VS2017 ARM Template Picker

Now I have a great starting point, in PowerShell, for setting up my Service Fabric Cluster:

ARM PowerShell

I also get a good starting point for the accompanying JSON file required by ARM to represent my infrastructure items:

ARM JSON

But the best part about using ARM templates in Visual Studio 2017, is that I can see a neat outline of all my ARM template resources, parameters, variables and outputs right there in Visual Studio 2017:

VS2017 JSON Outline for ARM

Visual Studio Code Support

Another cool thing about ARM templates, is that you can also edit them in Visual Studio Code and you get full intellisence support via a Microsoft plugin:

Visual Studio Code Plugin for ARM Templates

Epilogue

As you can see, ARM is a pretty compelling technology that will help you in your quest to automate all the (cloudy) things! Use it to automate your infrastructure and save your changes in source control (Git) so you can version out your infrastructure (as code) and continue to grow your enterprise at cloud scale.

That is all for now, hope this helps and happy DevOps!