On one of my recent projects I was configuring a build pipeline for our project that had to be deployed to Azure from VSTS aka Visual Studio Online. We had a variety of services including WebApps, WebJobs, Storage Accounts, Azure Search, Azure Worker Roles and VMs. Normally I would use PowerShell to deploy to existing azure roles and infrastructure  using build vNext but this time I used Azure Resource Manager templates to deploy the roles, VMs and other services.

Azure resource manager templates are JSON configurations of Azure components that can be grouped together to easily create the desired infrastructure. For e.g. a template can deploy your complete pipeline in a sequence that may include Storage Accounts, WebApps, VMs and other services in a new Resource Group from the build pipeline. Components can be marked as dependent on other components and we can reference the resulting keys and other properties from other components and even return them as outputs for consumption in our PowerShell scripts and in other templates as parameters.

Resource Group - mParsec

If you use Visual Studio to edit templates then there is an added advantage of IntelliSense as the JSON templates have schemas. You can also use the JSON Editor in Visual Studio that now has support for Azure Resource Manager templates but be careful that Azure components and new features are added on regular basis and using older schemas might not expose some of the properties and features that you might find helpful in your deployment scenarios. In some cases there are properties that will not be present in the most recent schema definitions and they can be used but there is a solution for that too.

Virtual Network - mParsec

One of the most important feature of the Resource Manager templates is the ability to reverse engineer your deployed infrastructure into a template using Azure Resource Explorer. This tool allows to view the deployed components in JSON definitions that can easily be converted into new templates. The benefit of using this tool is that we can view configurable properties that are not even documented as the documentation is usually lagging behind when Azure is growing with such a rapid pace.

To get started you can view Azure Quick Start Templates site, an excellent resource provided by Microsoft. I think that was enough for an intro now take some time looking into the following resources to dig deeper.

Azure Resource Manager Documentation
Azure Resource Explorer
Azure Quickstart Templates
Azure Quickstart Templates github source

By |2018-12-11T06:03:10+00:00February 6th, 2016|Technology|Comments Off on AZURE RESOURCE MANAGER TEMPLATES

About the Author: