Feb 22 2021

Use These 3 Steps to Deploy Resources Inside the Azure Cloud

Get set up in the Azure cloud environment with these three steps.

Azure Resource Manager templates are text files created in the JavaScript Object Notation (JSON) format that define what cloud resources to provision within Azure. Once an ARM template is built, an administrator can deploy it to Azure, instructing it to build the resources therein. To follow the steps provided here, you must first be sure you have an Azure subscription and have downloaded and installed the Azure command-line interface (CLI) tool.

1. Write the ARM Template

The first task of deploying resources to Azure is writing the ARM template itself. To get started, download a sample prebuilt template at fedtechmag.com/ARM. This template creates an Ubuntu 18.04 Azure virtual machine and all associated resources.To be clear, the provided ARM template is just an example. An actual template used in a real environment will look different based on the kind of resources the ARM template is deploying.

2. Validate the ARM Template

Validation of a new template ensures the template has no bugs or syntax issues and can be successfully deployed with no errors. Using the Azure CLI, validate an ARM template by running the az group deployment validate command shown below. First, replace your_resource_group_name with the name of an actual resource group in your Azure subscription. This command reads the template LinuxVirtualMachine.json and parameters defined in the file LinuxVirtualMachine.parameters.json, which then validates the ARM template and the parameters file: az group deployment validate --resource-group your_resource_group_name --parameters .\LinuxVirtualMachine.parameters.json --template-file .\LinuxVirtualMachine.json

3. Deploy the ARM Template

Using the Azure CLI again, deploy the Azure resources defined in the template using az group deployment command again. This time, however, remove the validate command to deploy the Azure resources defined in the ARM template.

az group deployment create --resource-group your_resource_group_name --parameters .\LinuxVirtualMachine.parameters.json --template-file .\LinuxVirtualMachine.json.

This command reads the LinuxVirtualMachine.json ARM template and the LinuxVirtual Machine.parameters.json parameters file. It then replaces all of the parameter place holders in the ARM template with values in the parameters file and invokes the deployment.

SimeonVD, lvcandy/Getty Images