Lesson 5 of 5 Managing and Deploying Azure Resources

Understanding Azure Resource Manager and ARM Templates

This lesson explains Azure Resource Manager, through which every management request passes, and ARM templates and Bicep, Azure's native infrastructure-as-code formats.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe the role and benefits of Azure Resource Manager.
  • Describe the structure and benefits of ARM templates.
  • Explain the relationship between Bicep and ARM templates.

Azure Resource Manager

Azure Resource Manager (ARM) is the deployment and management service for Azure. It provides a management layer that enables you to create, update and delete resources in your Azure account. Anytime you do anything with your Azure resources, ARM is involved. The following sequence shows how a request is processed.

  1. A tool sends a request

    The Azure portal, Azure CLI, Azure PowerShell, an SDK or a REST client sends a request, such as creating a VM.

  2. ARM authenticates and authorizes

    Azure Resource Manager checks the caller's identity with Microsoft Entra ID and their permissions with Azure RBAC.

  3. Governance is applied

    Azure Policy and resource locks are evaluated, so a request that breaks a rule is denied.

  4. The service carries out the request

    ARM sends the request to the resource provider, such as Microsoft.Compute, which creates or changes the resource.

Because all requests are handled through the same API, you see consistent results and capabilities in all the different tools. With Azure Resource Manager, you can:

  • Manage infrastructure through declarative templates rather than scripts.
  • Deploy, manage and monitor all the resources for a solution as a group, rather than individually.
  • Redeploy a solution throughout the development lifecycle and have confidence that resources are deployed in a consistent state.
  • Define the dependencies between resources so that they are deployed in the correct order.
  • Apply access control to all services, because Azure RBAC is natively integrated into the management platform.
  • Apply tags to resources to logically organize all the resources in a subscription, and clarify billing by viewing costs for a group of resources that share the same tag.

The following diagram follows a request through Azure Resource Manager.

How Azure Resource Manager handles a request. Every tool, the Azure portal, Azure CLI, Azure PowerShell, an SDK or a REST client, sends its request to Resource Manager. Resource Manager authenticates the caller with Microsoft Entra ID and authorizes it with Azure RBAC, then applies Azure Policy and resource locks, and finally passes the request to the resource provider, such as Microsoft.Compute, which creates or changes the resource. Because every tool uses the same API, results are consistent.
Every tool goes through the same management layer.
Put in order

A request through ARM

Exam skills 3.3.5

Put the stages of an Azure Resource Manager request in order.

Log in to try this activity Interactive activities are free with an account.

ARM templates

An ARM template is a JavaScript Object Notation (JSON) file that defines the infrastructure and configuration for a deployment, using declarative syntax: you describe what you want to deploy without writing the sequence of commands to create it. A template has a standard structure with sections such as parameters (values supplied at deployment, such as an environment name), variables, resources (what to deploy) and outputs (values returned after deployment).

ARM templates have several benefits:

  • Declarative syntax: the template states what to deploy, not how.
  • Repeatable results: the same template deploys the same resources in a consistent state every time, across the development lifecycle.
  • Orchestration: ARM orders operations correctly from the dependencies in the template and deploys independent resources in parallel, so deployments finish faster.
  • Modular files: templates can be broken into smaller, reusable components and linked or nested together.
  • Extensibility: deployment scripts can run PowerShell or Bash as part of a deployment.
Match the pairs

Inside an ARM template

Exam skills 3.3.5

Match each ARM template section or feature with its purpose.

Log in to try this activity Interactive activities are free with an account.

Bicep

Bicep is a language that uses declarative syntax to deploy Azure resources. It is designed to be simpler and more concise than JSON, and a Bicep file is compiled into an ARM template before deployment, so it has the same capabilities and goes through the same Azure Resource Manager process. Bicep supports all resource types and API versions from the day they are released, and it breaks large deployments into modules. For example, the following Bicep file deploys a storage account.

param location string = resourceGroup().location

resource storage 'Microsoft.Storage/storageAccounts@2023-05-01' = {
  name: 'stdemo${uniqueString(resourceGroup().id)}'
  location: location
  sku: { name: 'Standard_LRS' }
  kind: 'StorageV2'
}

The equivalent ARM template in JSON is several times longer. Microsoft recommends Bicep for new Azure-only IaC, but ARM templates remain fully supported, and the portal can export existing resources as ARM templates.

Worked example

Consistent environments

A team needs to deploy a virtual network, two VMs and a storage account to development, test and production. The VMs depend on the network, and each environment uses different names. The team wants identical, repeatable deployments with as little scripting of the deployment order as possible. What should it use?

Use an ARM template (or a Bicep file that compiles to one) with a parameter for the environment name. Azure Resource Manager reads the dependencies, deploys the network before the VMs and the independent storage account in parallel, and produces the same result in every environment. An Azure CLI script could create the resources, but the team would have to write the order and error handling itself, and running it again could fail if resources already exist.

Check yourself

What happens to a Bicep file before it is deployed?

Show answer

It is compiled into an ARM template, which Azure Resource Manager deploys.

Exam Tips

Remember for the exam

  • Azure Resource Manager handles every management request, whatever the tool, so results are consistent.
  • ARM provides authentication, authorization with RBAC, Azure Policy, locks, tags and group deployment.
  • ARM templates are declarative JSON files with parameters, variables, resources and outputs.
  • Bicep is a simpler declarative language that compiles to ARM templates.