Mastering Azure Automation (Part 1 of 3 Learning Azure Resource Manager Templates)

This is a series of three blog posts covering different aspects of Azure Automation , here I am covering Azure Resource Manager also called as ARM. This is the 1st part of a 3 part Blog Series on Mastering Azure Automation.

1 Mastering Azure Automation (Part 1 of 3 Learning ARM Templates)
2 Mastering Azure Automation (Part 2 of 3 Learning Azure runbooks)
3 Mastering Azure Automation (Part 3 of 3 Learning Desired State configurations)

What is Azure Resource Manager (ARM)?

Azure Resource Manager lets you create, deploy, update or delete resources for your cloud solution in a single, coordinated operation. Resources can include docker containers, virtual machines, storage accounts, virtual networks, services, or any component that you need for your project.

This module will take a look at the two deployment models that are available in Azure, but mainly we’re going to focus on the newer Azure Resource Manager or ARM deployment model.

Azure Resource Manager is a deployment methodology that allows you to define what  you want for infrastructure. So you may have heard the term Infrastructure as code or declarative infrastructure. You’re not worrying about the workflow or the sequencing. If you’re a traditional IT pro or you’ve ever installed applications or set something up, if you’re building a database, you’ve got to install the operating system, install the database, install the database server then the database, install your app and then configure everything. So there’s a workflow that you’ve got to go through and if you’r going to script or automate that if something fails you’ve got to build the logic to fail back and fix it and move on and so on the past deployment scripts particularly automated deployments could get very very complex and very complicated.

What Azure Resource Manager does is allows you to define your entire deployment in a file and that file is called an ARM or Azure Resource Manager template. We’ll look at those in a little bit in depth. But we can now define them as a file and then apply that file to an Azure subscription effectively allowing Azure to take care of all the details of how
that deployment is supposed to work. Now some additional benefits of this model.
If for example your deployment is broken, you don’t need to figure out why or how, you can simply re-deploy it. If you’re doing test and dev, you can define the template and deploy it three times.

Once for test, once for dev and once for production. You can use these templates to create what are called resource groups. I take that template I could deploy it in a group and then the group becomes a unit for things like billing, so I can see how much I’m being charged per group and then additionally you can do all this with PowerShell. So in addition to being able to define the templates or you can apply the templates with PowerShell. You can download templates with PowerShell and you can also automate all the steps with PowerShell.

Why use ARM?

  • You can create,deploy, manage, and monitor all of the resources for your solution in a group, also called as a resource group, rather than deploying these resources individually.
  • You can repeatedly deploy your solution for multiple environements (like Dev/QA/Staging/Production).
  • You can use declarative (json based) templates to define your deployment.
  • You can define the dependencies between resources so they are deployed in the correct order.
  • You can apply access control to all services in your resource group because Role-Based Access Control (RBAC) which is natively integrated into the management platform.
  • You can apply tags to resources to logically organise all of the resources in your subscription.
  • You can clarify billing for your organisation by viewing the rolled-up costs for the entire group or for a group of resources sharing the same tag.


What is Access Control?

Resource Manager enables you to control who has access to specific actions for your organization. It natively integrates role-based access control (RBAC) into the management platform and applies that access control to all services in your resource group. You can add users to pre-defined platform and resource-specific roles and apply those roles to a subscription, resource group, or other resource to limit access. For example, you can take advantage of the pre-defined role called Reader that permits users to view resources but not edit them. You add users in your organization that need this type of access to the Reader role and apply the role to the subscription, resource group or resource. Other platform roles include Owner, Contributor, and User Access Administrator.

ARM Template Structure

An ARM template consists of JSON and expressions which you can use to construct values for your deployment. You must limit the size your template to 1 MB, and each parameter file to 64 KB. The 1 MB limit applies to the final state of the template after it has been expanded with iterative resource definitions, and values for variables and parameters.

   "$schema": "",
   "contentVersion": "",
   "parameters": {  },
   "variables": {  },
   "resources": [  ],
   "outputs": {  }
  • $Schema: Location of the JSON schema file that describes the version of the template language.
  • contentVersion: Version of the template (such as
  • parameters: Optional values that are provided when deployment is executed to customize resource deployment.
  • resources: A manageable item that is available through Azure. Some common resources are a virtual machine, storage account, web app, database, and virtual network, but there are many more.
  • outputs: Values that are returned after deployment

Creating an Azure Automation account on Azure

Step 1: Open Azure Portal and Create new Azure Automation Account as shown below


Step 2: Click on Runbook under Process Automation CreateRunbook.PNG

Step 3: Select Azure Automation Tutorial Script


Step 4: Following Code is written inside this Script

Step 5: Now run this Script and it will list all the resources in all resource groups of my subscription as shown below


Another Example : Let us deploy 1 VM having ( 2 NICs, 2 Subnets and 1 Vnet)


So this is how our Azure ARM Template should look.

Once I deploy this template to Azure Resource Manager , it should show following wizard on Azure. I just need to click on Purchase and my resources will be deployed.



Once Deployment gets succeed our Azure Resources shows up as shown below


Here is a short Video Explaining ARM Templates :


Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.