
Introduction
ARM template is used to create resources as per the Azure Resource Manager. The template file is written in JSON. And we can deploy it using the azure portal or locally using Azure CLI or Azure PowerShell. Here, in this blog, we will deploy the template using the local method.
Prerequisite
- Understanding of Azure Services
- Linux OS
- Visual Studio Code ( optional )
Preparations for the ARM template
1. VS Code Extension
If you have visual studio code installed on your system locally, you can install the following extension for the ARM template: Azure Resource Manager (ARM) tools. This provides snippets and auto-completion for ARM templates.
2. Azure CLI setup
We need to install Azure CLI on our local system. And so, we follow the steps defined here. These are steps for Ubuntu but you may change them as per your Operating System.
Then do login on to your Azure account using Azure CLI


Now configure default values to make it easy for deployment, like location and resource group.

Creating the ARM template
- Create an azuredeploy.json file.
- Open in Visual studio code.
- Type arm and select the first option. The ARM tools extension creates a basic snippet.
- Similarly, click inside resources and type storage and select the first option. We now have the storage account snippet.
- As you can see inside the snippet, the location is already parameterized.
- We will parameterize the name and storage type option.
- We add parameters inside parameters. Click inside the square brackets and type par and press “ENTER“
- After that, we modify the snippets as shown in the diagram.
- And then we modify the resource values to take the input per the parameters defined.
- If we want, we can add output to define what to print after the successful deployment.


Adding parameters


Modify them as per use.

Modify values in resources.

Define the outputs.

Running the ARM Template
We run the following set of commands.

And when it says running on Azure CLI, we move to the azure portal to see if it is deploying: Home —> Resource groups —> Resource Group selected —> deployments

Once the deployment completes, it shows completed. Click on the deployment name and go to the resource.


Similarly, the Azure CLI gives output.

Conclusion
The ARM template is similar to AWS cloud formation and other IaC automation available. This was for learning you can modify and play with source code from Knoldus TechHub. Keep Learning!
References
- https://azure.microsoft.com/en-in/products/arm-templates
- https://github.com/Azure/azure-quickstart-templates