easyMultiple ChoiceObjective-mapped
AZ-400 Practice Question: You run the Azure CLI command shown in the exhibit
Network Topology
You run the Azure CLI command shown in the exhibit. What is the output?
⚠ Common exam trap
The trap here is that candidates might think the query syntax is invalid (Option A) due to unfamiliarity with JMESPath, or they might overlook the location filter and assume the command returns all VMs (Option C) or VMs in a different location (Option D).
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
A table showing VM names and resource groups for VMs in eastus
The Azure CLI command `az vm list --query "[?location=='eastus'].{Name:name, ResourceGroup:resourceGroup}" --output table` filters virtual machines to only those in the 'eastus' location, then projects the 'name' and 'resourceGroup' properties into a table. The `--query` parameter uses JMESPath syntax, which is correct here, and the `--output table` formats the result as a table. Therefore, the output is a table showing VM names and resource groups for VMs in eastus.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
An error because the query syntax is incorrect
Why it's wrong here
The Azure CLI --query parameter uses JMESPath, and the given expression is syntactically valid because it correctly combines a filter condition (location == 'eastus') with a projection (name, resourceGroup). Therefore, the command runs successfully and does not produce a query syntax error.
- ✓
A table showing VM names and resource groups for VMs in eastus
Why this is correct
This command retrieves the list of VMs in the subscription and then applies a JMESPath query that filters to only those VMs where the location property equals 'eastus', projecting the name and resourceGroup properties. With --output table, these are displayed as a table showing VM names and their resource groups, making this the correct outcome.
- ✗
A list of all VMs in the subscription
Why it's wrong here
The JMESPath query explicitly includes the condition location == 'eastus', which restricts the result set to VMs in the East US region only. Since VMs in other locations are filtered out, the output is not a list of all VMs in the subscription.
- ✗
A list of all VMs in the westus location
Why it's wrong here
The query condition specifies location == 'eastus', not 'westus', so all matching VMs are within the East US region. VMs located in West US are excluded by this filter, so the listed VMs are not from the westus location.
Go deeper
Related to this question
About these practice questions
Courseiva writes every AZ-400 question from scratch — 823 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This AZ-400 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AZ-400 exam.