Today is Azure RM template structure day! Well… it should be.

What is JSON?

JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate.

I’m glad I can make myself clear to robots!

talk like a robot when using azure rm templates

Structure of ARM templates


According to Wikipedia, a parameter in computing is defined as “a reference or value that is passed to a function, procedure, subroutine, command, or program”.

So, we can use parameters to deploy custom resources. If we do not create parameters in our template, the deployed resources would always turn out the same. Boring, right?

Luckily, we can use these parameters to bring a bit of flair in our deployments. Let’s say we would like to create a virtual machine template. Of course, we would like to customize the name of the new machine.

We declare a parameter “virtualMachineName“, type “String” in our template.

"parameters": {
    "virtualMachineName": {
        "type": "String"

This virtualMachineName parameter we use when deploying our template. Azure CLI, PowerShell or uploading our template to Azure are all options. Next, we will be prompted to complete our defined parameters.

Now, we choose a beautiful name for our machine. This will be written to our parameter. Whenever the parameter is used in the body of the template, we will see our virtualMachineName dynamically added.
“Beautiful name” –> Parameter “virtualMachineName” –> Script –> VM with name “Beautiful name”



Variables are containers for storing data.

For example, you would like to provision some machines hosting a specific application. These machines all need a local administrator account. Let’s store that “localAdmin” account name in a variable.

"variables": { 
    "localAdmin": "Gandalf"

Recommendations from Microsoft:

  • Use variables for values that you need to use more than once in a template. If a value is used only once, a hard-coded value makes your template easier to read.
  • You cannot use the reference function in the variables section of the template. The reference function derives its value from the resource’s runtime state. However, variables are resolved during the initial parsing of the template. Construct values that need the reference function directly in the resources or outputs section of the template.
  • Include variables for resource names that must be unique.


This one is self-explanatory. In the “Resources” section of we can define resources.

Easy as pie… ow… nevermind. We have some things to keep in mind:


  • Export a template.
  • Check out the parameters, variables and resources sections.
  • Find some examples of things you would like to customize.

Quite some reading material above. Next time we will do some practical stuff. I promise.