BACK TO ARTICLES

Infrastructure as Code (IaC): Azure ARM Templates vs Azure CLI v2 – A Practical Scenario

Published on August 24, 2020

Fakhar ul Hassan

Infrastructure Consultant, Cloud Architect & Automation, DevOps, Infrastructure as Code (IaC), Ansible, Terraform

Infrastructure as Code (IaC): Azure ARM Templates vs Azure CLI v2 – A Practical Scenario

The Azure ARM templates have some considerable issues in case of bulk deployment of resources, which can be a decisive factor as whether we should use ARM templates or Azure CLI v2. 

To explain the issue, lets discuss with an example:

Example:

Consider we have an existing (i.e. production) environment where some resources already exist and being utilized. We need to perform a task to deploy 50 more VMs (different templates for different sets of VMs) in a single shot. When we run the automated deployment of multiple ARM templates for different set of VMs. Some of the ARM templates could not provision or configure all the resources and partially failed (i.e. One template executed and partially failed to provision/configure resources). It is a practical scenario due to the declarative nature of ARM templates. So, we shall end up in a scenario of reconciling and fixing of these partially deployed/configured and failed resources. (see above figure for reference).

Now, consider the same requirement of automated deployment of 50 VMs in a (i.e. production) environment. Now instead of ARM templates, we used Azure CLI v2 to automatically validate the resource’s existing state before starting the automated deployment and in case of conflicts/issue, prompting back to us about the expected issues. Thus enabling us to make appropriate corrections and re-run the deployment without any issues.

Former is the reactive approach whereas the later one is the preventive approach. Now it’s up to us to decide, as what kind of environment we can afford!

Written by

Fakhar ul Hassan

Infrastructure Consultant, Cloud Architect & Automation, DevOps, Infrastructure as Code (IaC), Ansible, Terraform