Skip to main content

Command Palette

Search for a command to run...

Lab 03: Managing Azure Resources with ARM and Bicep Templates

Updated
3 min read

visit microsoft learn github for complete instructions

This lab teaches you to automate Azure deployments using ARM and Bicep templates. You'll learn to create, edit, and deploy them using the Azure portal, PowerShell, and CLI.

Interactive Simulations

Optional simulations to reinforce your understanding:

Lab Scenario

Your team wants to automate and simplify resource deployments to reduce administrative overhead, human error, and increase consistency.

Diagram of the tasks.

Tasks

  1. Create an ARM Template: Create a managed disk and export its template.

  2. Edit and Redeploy: Modify the template and redeploy to create another disk.

  3. Deploy with PowerShell: Configure Cloud Shell and deploy the template using PowerShell.

  4. Deploy with CLI: Deploy the template using CLI commands in Cloud Shell.

  5. Deploy with Bicep: Use a Bicep file to deploy a managed disk.

Task 1: Create an ARM Template

  1. Sign in to the Azure portal: https://portal.azure.com and Navigate to: Disks > Create

  2. Create a managed disk (e.g., az104-disk1 in East US).

  3. Go to the disk's resource > Automation > Export template.

  4. Download the template and extract the two JSON files. (template and parameters file)

Task 2: Edit and Redeploy

  1. Search for "Deploy a custom template" in the portal.

  2. Select "Build your own template in the editor".

  3. Upload template.json and modify it (e.g., change disk name to az104-disk2).

  4. Upload parameters.json and update it to match the template.

  5. Deploy the template and verify the new disk is created.

Task 3: Deploy with PowerShell

  1. Open Cloud Shell in the Azure portal and select PowerShell.

  2. Mount a storage account and upload the template files.

  3. Edit template.json in the Cloud Shell editor (e.g., change disk name to az104-disk3).

  4. Run the following command to deploy:

PowerShell

New-AzResourceGroupDeployment -ResourceGroupName az104-rg3 -TemplateFile template.json -TemplateParameterFile parameters.json
  1. Verify the disk is created using Get-AzDisk.

Task 4: Deploy with CLI

  1. Switch to Bash in Cloud Shell.

  2. Edit template.json (e.g., change disk name to az104-disk4).

  3. Run the following command to deploy:

Bash

az deployment group create --resource-group az104-rg3 --template-file template.json --parameters parameters.json
  1. Verify the disk is created using az disk list --output table.

Task 5: Deploy with Bicep

  1. Stay in Bash in Cloud Shell.

  2. Upload the azuredeploydisk.bicep file.

  3. Edit the Bicep file and make changes (e.g., change disk name, SKU, size).

  4. Run the following command to deploy:

Bash

az deployment group create --resource-group az104-rg3 --template-file azuredeploydisk.bicep
  1. Verify the disk is created.

Cleanup

Delete the resource group to avoid unnecessary costs.

Extend Your Learning

Use Copilot in Edge or copilot.microsoft.com to explore further:

  • ARM template format and components

  • Using existing ARM templates

  • Comparing ARM and Bicep templates

Key Takeaways

  • ARM templates enable managing infrastructure as a group.

  • ARM templates use JSON for declarative infrastructure definition.

  • Parameters can be stored in separate JSON files.

  • ARM templates can be deployed via various methods.

  • Bicep offers a simpler and more efficient alternative to ARM templates.

6 views

More from this blog

A

An Azure Cloud Lab Journey...

45 posts