Understand what Azure ARM templates are

The infrastructure for an application is typically made up of many components – a server to execute and respond to all calls, a storage mechanism to handle all I/O (input/output) , some kind of networking mechanism and finally off course, your application. Your application may be a standalone application with or without any database support and with or without any 3rd party integration services. You don’t generally want to see these components as separate entities or you may be (depending upon your background in Information Technology Sector) .

Generally, if you are a consumer, all you are concerned about is to consume how services available by a particular piece of the application.  If you are looking from infrastructure point of view, you do not see them as separate entities. You would want to see them as related and interdependent parts of a single entity (off course, your application). You would then want to deploy, manage and monitor them as a group. Azure Resource Manager enables you to work with resources as a group all together. You are able to deploy, update or delete all the resources for your solution or application in a single, coordinated operation.

Azure Resource Manager templates or ARM templates ate a way to use templates for deployment for different environment such as testing, staging and production. These templates need to be defined using a specialized syntax, so that Azure can recognize all the information that is contained within them.

The ARM templates are written in JSON format and are only applicable to Resource Manager model. By using a template, one can repeatedly deploy the solution throughout its lifecycle and be assured that resources are deployed in a consistent state.  Again, the templates can be re-used and customized or tailored as well.

Azure Resource Manager processes the template like any other request. It parses the template and converts its syntax into REST API operations for the appropriate resource providers. For example, when Resource Manager receives a template with the following resource definition for provisioning of a storage account in the West US Datacenter:

"resources": [
  {
    "apiVersion": "2016-01-01",
    "type": "Microsoft.Storage/storageAccounts",
    "name": "mystorageaccount",
    "location": "westus",
    "sku": {
      "name": "Standard_LRS"
    },
    "kind": "Storage",
    "properties": {
    }
  }
]

It gets converted to following REST API operation:

PUT
https://management.azure.com/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.Storage/storageAccounts/mystorageaccount?api-version=2016-01-01
REQUEST BODY
{
  "location": "westus",
  "properties": {
  }
  "sku": {
    "name": "Standard_LRS"
  },   
  "kind": "Storage"
}

The format for writing JSON templates is very simple and clean as well.  We can also have multi tier templates or linked templates and define inter-dependencies between resources.

In next few posts, we’ll see about syntax of ARM templates, available functionality, relationships and creating a few sample resources.

One thought on “Understand what Azure ARM templates are

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s