How to Deploy Azure Resources using ARM Templates?

Azure Resource Manager (ARM) 

ARM stands for Azure Resource Manager. Azure Resource Manager (ARM) is a Microsoft Azure native platform for infrastructure as code (IaC) for deploying all the azure resources. ARM templates enables you to centralize the management, deployment, and security of Azure resources.

ARM template is a JSON file that defines what you want to deploy to Azure. ARM template can be integrates with Azure portal, PowerShell, CLI, and REST API to perform deployment and management tasks.

What are the advantages of using ARM templates?

  • Automate resource deployments (create, update, and delete) using templates.
  • ARM template can be used to deploy the resources consistently and repeatedly.
  • Managing JSON templates are simpler then managing XML templates.
  • Centralized management and Security

Deploy Resources with Azure ARM Template

When using Azure Resource Manager, you can use a template for deployment. You can create an ARM template with the help of Visual Studio Code. 

Once you have the template then you can deploy that ARM template either using the Azure CLI or the Azure PowerShell.

Step 1: Sign in to Azure Portal to start working with PowerShell or the Azure CLI.

Login in to your Azure account using Az CLI Login

command: az login

Now, switch to your active Azure Subscription

command: az account set --subscription [subscriptionID/subscriptionName]

Note: enter the subscription name that you want to use and replace the [] with your target subscription id or name

Step 2: Create a Azure resource group using Az CLI command

When deploying template, we need to specify resource group. So first you should create a resource group.

command: az group create --name "dev-rg" --location "eastus"

Step 3: Deploy ARM Template

Note: replace the {} with the path of your template file.

templateFile = "{provide-the-path-to-the-template-file}"
az deployment group create --name armtemplate --resource-group "dev-rg" --template-file $templateFile

This Deployment command returns result.

Step 4: verify your resource deployment status in Azure Portal.