Lab 026: Deploy Azure Resources Using ARM Template
Requirements
You are tasked with modifying an ARM template for deploying a virtual network. The current template is located in the /root/arm-templates directory under the filename vnet-deployment-template.json. You need to make the following changes to the template:
-
Change the name and displayName tag of the virtual network to arm-vnet-devops.
-
Update the addressPrefixes to 192.168.0.0/16.
-
Add one more tag named Environment with value KKE-devops.
-
After making these changes, you need to deploy the ARM template using the Azure CLI.
This page keeps the original requirements intact and focuses on one direct ARM template update and deployment workflow.
Prerequisites
- Azure CLI is installed and authenticated on
azure-client. - The template file exists at
/root/arm-templates/vnet-deployment-template.json. - You have permission to deploy resources in the target resource group.
Steps
For the Azure credentials, enter showcreds command. For further details, check out the Project Nautilus documentation.
# Fetch the resource group name that matches 'kml'
RG=$(az group list --query "[?contains(name, 'kml')].name" --output tsv)
TEMPLATE_FILE='/root/arm-templates/vnet-deployment-template.json'
# Update the file
vi /root/arm-templates/vnet-deployment-template.json
# Declare other variables
az deployment group create --resource-group $RG --template-file $TEMPLATE_FILE
Verification
- Confirm deployment completes successfully.
- Confirm VNet name is
arm-vnet-devops, address prefix is192.168.0.0/16, and tagEnvironment=KKE-devopsis present.
az deployment group show --resource-group "$RG" --name $(az deployment group list --resource-group "$RG" --query "[0].name" -o tsv) --output table
az network vnet show --resource-group "$RG" --name arm-vnet-devops --query "{Name:name,Address:addressSpace.addressPrefixes[0],Environment:tags.Environment,DisplayName:tags.displayName}" --output table