Lab 03: Managing Azure Resources with ARM and Bicep Templates
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:
Manage resources with ARM templates: Create and deploy managed disks.
Create a VM with a template: Deploy a VM using a Quickstart template.
Lab Scenario
Your team wants to automate and simplify resource deployments to reduce administrative overhead, human error, and increase consistency.

Tasks
Create an ARM Template: Create a managed disk and export its template.
Edit and Redeploy: Modify the template and redeploy to create another disk.
Deploy with PowerShell: Configure Cloud Shell and deploy the template using PowerShell.
Deploy with CLI: Deploy the template using CLI commands in Cloud Shell.
Deploy with Bicep: Use a Bicep file to deploy a managed disk.
Task 1: Create an ARM Template
Sign in to the Azure portal: https://portal.azure.com and Navigate to: Disks > Create
Create a managed disk (e.g.,
az104-disk1in East US).Go to the disk's resource > Automation > Export template.
Download the template and extract the two JSON files. (template and parameters file)
Task 2: Edit and Redeploy
Search for "Deploy a custom template" in the portal.
Select "Build your own template in the editor".
Upload
template.jsonand modify it (e.g., change disk name toaz104-disk2).Upload
parameters.jsonand update it to match the template.Deploy the template and verify the new disk is created.
Task 3: Deploy with PowerShell
Open Cloud Shell in the Azure portal and select PowerShell.
Mount a storage account and upload the template files.
Edit
template.jsonin the Cloud Shell editor (e.g., change disk name toaz104-disk3).Run the following command to deploy:
PowerShell
New-AzResourceGroupDeployment -ResourceGroupName az104-rg3 -TemplateFile template.json -TemplateParameterFile parameters.json
- Verify the disk is created using
Get-AzDisk.
Task 4: Deploy with CLI
Switch to Bash in Cloud Shell.
Edit
template.json(e.g., change disk name toaz104-disk4).Run the following command to deploy:
Bash
az deployment group create --resource-group az104-rg3 --template-file template.json --parameters parameters.json
- Verify the disk is created using
az disk list --output table.
Task 5: Deploy with Bicep
Stay in Bash in Cloud Shell.
Upload the
azuredeploydisk.bicepfile.Edit the Bicep file and make changes (e.g., change disk name, SKU, size).
Run the following command to deploy:
Bash
az deployment group create --resource-group az104-rg3 --template-file azuredeploydisk.bicep
- 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.