Other tools
ARM templates are not the only way to manage resources via ARM. There are external tools that you can consider if you find this particular feature cumbersome or counterproductive. These tools are as follows:
- Azure Fluent: A set of helpful SDKs that enable you to programmatically call ARM APIs to provision resources. They are written for multiple different platforms (.NET, Java, Python, or Node.js).
- Terraform: A tool by HashiCorp where you use a YAML file to describe your infrastructure.
- Pulumi: A new project where you can use TypeScript, Go, or Python to write scripts that describe your infrastructure.
Once you have your template prepared, you probably want to deploy it. The easiest way to do so is to use the CLI. The following is an example of the command required to deploy the template we created earlier:
az group deployment create --name <name-of-a-deployment> --resource-group <name-of-rg> --template-file <name-of-your-file>.json
The preceding command will create a new deployment with a specific name and use a particular template file. Of course, if your template accepts parameters, you can pass them using the --parameters switch:
az group deployment create --name <name-of-a-deployment>--resource-group <name-of-rg> --template-file <name-of-your-file>.json --parameters storageAccountType=Standard_GRS
Once the deployment is finished, you should see a JSON file that represents the serialized output of the operation. Each deployment can be found in the Deployments blade of your resource group:
With ARM templates, you can quickly provision your infrastructure in any region available in Azure. As it is a native way of deploying resources in Azure, it is important to understand at least the basic features of this functionality so that you can quickly multiply required services. To better understand the advanced topics (such as conditional statements, functions, and linked templates), take a look at the following link: https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/template-syntax. It contains a full description of the syntax and its structure.
Although JSON templates are often a recommended way of managing resources in Azure, do not forget about alternatives. Azure Fluent, Terraform, and Pulumi can be really interesting propositions, especially if you are working with IaaS architectures.
Deciding which tool is the best for you relies solely on your actual requirements. In many setups, a mix of available tools will give the best results. The next section will help you enhance your deployments by introducing locks, which help in preventing accidental deletion of resources or changes in their configuration.