2. Which Azure CLI command is used to view metrics for a resource?
easy
A. az storage account delete --name
B. az monitor metrics list --resource
C. az vm create --name
D. az network vnet list
Solution
Step 1: Identify the command for monitoring metrics
The command az monitor metrics list lists metrics for a resource.
Step 2: Confirm the command matches the monitoring purpose
Options A, B, and D perform unrelated tasks like storage deletion, VM creation, or listing VNets.
Final Answer:
az monitor metrics list --resource <resource-id> -> Option B
Quick Check:
Metrics command = az monitor metrics list [OK]
Hint: Use 'az monitor metrics list' to check resource metrics [OK]
Common Mistakes:
Confusing VM or storage commands with monitoring commands
Omitting the --resource parameter
Using commands that list unrelated resources
3. What is the output of this Azure CLI command?
az monitor metrics list --resource /subscriptions/123/resourceGroups/myRG/providers/Microsoft.Compute/virtualMachines/myVM --metric CPUPercentage --interval PT1M --output table
medium
A. A JSON object with storage account details.
B. An error saying the resource ID is invalid.
C. A list of all virtual machines in the resource group.
D. A table showing CPU usage percentage of the VM every minute.
Solution
Step 1: Analyze the command parameters
The command requests CPUPercentage metric for a VM resource with 1-minute intervals and table output.
Step 2: Determine expected output type
The output will be a table showing CPU usage data points for the VM over time.
Final Answer:
A table showing CPU usage percentage of the VM every minute. -> Option D
Quick Check:
Metrics output = table of CPU usage [OK]
Hint: Look for metric and output parameters to guess output format [OK]
Common Mistakes:
Assuming command lists VMs instead of metrics
Confusing resource ID with resource group
Expecting JSON when output is table
4. You run this command but get an error:
az monitor metrics list --resource myVM --metric CPUPercentage
What is the likely cause?
medium
A. The resource ID is incomplete; it needs the full Azure resource ID path.
B. The metric name CPUPercentage is invalid.
C. The command requires a storage account name instead of a VM name.
D. The Azure CLI is not installed.
Solution
Step 1: Check the resource parameter format
The command uses 'myVM' which is not a full resource ID; Azure expects full resource ID path.
Step 2: Understand error cause
Without full resource ID, Azure CLI cannot find the resource to get metrics.
Final Answer:
The resource ID is incomplete; it needs the full Azure resource ID path. -> Option A
Quick Check:
Full resource ID required = error [OK]
Hint: Always use full resource ID for monitoring commands [OK]
Common Mistakes:
Using just resource name instead of full ID
Assuming metric name is wrong
Thinking CLI is not installed without checking
5. You want to set up monitoring alerts in Azure to notify you when CPU usage exceeds 80% for 5 minutes. Which approach best uses monitoring to prevent downtime?
hard
A. Configure Azure Monitor alerts with action groups to send notifications on CPU threshold breaches.
B. Manually check CPU metrics daily using Azure CLI commands.
C. Increase VM size without monitoring CPU usage.
D. Disable monitoring to reduce costs and rely on user reports.
Solution
Step 1: Identify proactive monitoring method
Azure Monitor alerts can automatically notify when CPU exceeds thresholds, enabling fast response.
Step 2: Compare options for preventing downtime
Manual checks or ignoring monitoring delay response; increasing VM size blindly wastes resources.
Final Answer:
Configure Azure Monitor alerts with action groups to send notifications on CPU threshold breaches. -> Option A