Tools for Developing Azure Resource Manager Templates


This is a short article about a few tricks that can help you build Azure Resource Manager templates.

Most templates are quite easy to get started with, because there already is a lot of ready made templates out there e.g. in the, that can be used as inspiration.

The existing templates that are uploaded to the Azure Gallery can also be downloaded, and used for inspiration. Here’s how

But every now and then you might want to do something that nobody has done before (or at least documented). That is when proper tooling becomes a huge help.

Wanting to use resource for the first time, you have two great starting points:

  1. You can create the resource the way to you want it from the portal, and the inspect the created resource with which lets you see the arm templates for already created resources.
  2. Alternatively you can look at the schema definitions and that way figure out which types of resources you have access to and what properties they have (this approach is not necessarily easy and it requires a lot of guesswork).

When you have found the template for the resource you want to provision I strongly recommend that you use Visual Studio 2015 with the Azure SDK 2.6 to author your complete template. VS 2015 with Azure SDK 2.6 provides some intellisense to the authoring experience and it also validates your template. You should not rely 100% on that validation however as it sometimes is not correct.

If you are building a lengthy resource group, which contains many resources and only a few of them are giving you trouble. It can become a slow process to iron out the errors if you have to redo everything all the time.

This is when the ARMClient a command line tool for calling the ARM REST endpoints becomes as great help. If you haven’t heard of it, I don’t blame you as it is not an official Microsoft tool, although it is developed by Microsoft employees and I would expect that they do use it a lot internally. If you want an introduction to the tool then David Ebbo has written a great one.

But basically what the tools allows you to is to deploy a single resource from your ARM template from the command line by posting the JSON directly to the ARM REST endpoint.

E.g. creating a new Application Insight web test (something that I haven’t been able to find any guidance on, hence why this post was created) can be done by using the ARMClient with the following command line

c:\armclient>armclient put "" @webtest.json

And having a file located in the directory where you run the ARMClient from named webtest.json with the following content, yes the @ means a reference to a file, you could also pass in the JSON directly.
"name": "test-70-532test2",
"type": "microsoft.insights/webtests",
"location": "Central US",
"tags": {
"hidden-link:/subscriptions/cd0d7179-80a0-47e6-a209-9c12de0bbd37/resourceGroups/Default-Web-EastUS2/providers/microsoft.insights/components/70-532test2": "Resource",
"hidden-link:/subscriptions/cd0d7179-80a0-47e6-a209-9c12de0bbd37/resourceGroups/Default-Web-EastUS2/providers/microsoft.web/sites/70-532test2": "Resource"
"properties": {
"provisioningState": "Succeeded",
"Name": "Test",
"Description": "",
"Enabled": true,
"Frequency": 600,
"Timeout": 30,
"Kind": "ping",
"Locations": [
"Id": "us-tx-sn1-azr"
"Configuration": {
"WebTest": " <WebTest Name=\"Test\" Id=\"b6487e5b-ebfc-4007-a9bf-033f9ff01db8\" Enabled=\"True\" CssProjectStructure=\"\" CssIteration=\"\" Timeout=\"0\" WorkItemIds=\"\" xmlns=\"\" Description=\"\" CredentialUserName=\"\" CredentialPassword=\"\" PreAuthenticate=\"True\" Proxy=\"default\" StopOnError=\"False\" RecordedResultFile=\"\" ResultsLocale=\"\"> <Items> <Request Method=\"GET\" Guid=\"a0d2b4ed-e197-8ee1-fe97-431fc376e9ad\" Version=\"1.1\" Url=\"\" ThinkTime=\"0\" Timeout=\"300\" ParseDependentRequests=\"True\" FollowRedirects=\"True\" RecordResult=\"True\" Cache=\"False\" ResponseTimeGoal=\"0\" Encoding=\"utf-8\" ExpectedHttpStatusCode=\"200\" ExpectedResponseUrl=\"\" ReportingName=\"\" IgnoreHttpStatusCode=\"False\" /> </Items> </WebTest>"
"SyntheticMonitorId": "test-70-532test2"
Obviously all parameters in this file are hardcoded (subscription ids (cd0d7179-80a0-47e6-a209-9c12de0bbd37), name (test-70-532test2) and whatnot), as the ARMClient doesn’t support processing the template language, it is simply an easy way to call the REST endpoints authenticated.

So you should replace the subscription ID with that of your own.

A final thing I would like to give hints towards are when shit hits the fan and you template blows up on you. In that case it can be useful to use the following ARMClient call to get everything from management service operation log.

ARMClient GET$filter=resourceGroupName eq 'AzureResourceGroup2' and eventTimestamp ge '2015-07-06T00:00:37Z'

Again you should replace the subscription ID with that of your own and you can filter on e.g. resource group to only get management operations on a specific group for more details on how to query visit the MSDN page.