The answer is to use `az cognitiveservices account show` with the `--query` parameter to filter by the resource name. This is the most reliable method because the Azure CLI returns structured JSON, and the `--query` parameter leverages JMESPath to extract the exact endpoint property without relying on fragile string parsing or unstructured output. On the Microsoft Azure AI Engineer Associate AI-102 exam, this tests your ability to script programmatic access to Azure OpenAI endpoints, a common task when automating deployments or integrating with applications. A frequent trap is attempting to use `az cognitiveservices account list` and then manually grepping the output, which is error-prone and not scriptable. Instead, remember that `az cognitiveservices account show` targets a single resource by name, and combining it with `--query` gives you a clean, parseable value. Memory tip: think "show and query" to pinpoint the endpoint—like using a laser instead of a net.
AI-102 Plan and manage an Azure AI solution Practice Question
This AI-102 practice question tests your understanding of plan and manage an azure ai solution. Match the stated requirement to the specific cloud service, access model, or configuration option — many options are valid in isolation but not for this scenario. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.
Exhibit
Refer to the exhibit.
az cognitiveservices account list -g rg-ai --query "[?kind=='OpenAI'].{Name:name, Endpoint:properties.endpoint, Location:location}" -o table
Name Endpoint Location
chatgpt https://chatgpt.openai.azure.com/ eastus
gpt4 https://gpt4.openai.azure.com/ westeurope
You executed the Azure CLI command to list Azure OpenAI resources. You need to programmatically access the endpoint of the resource named 'gpt4' in a script. What is the most reliable way to extract the endpoint?
Refer to the exhibit.
az cognitiveservices account list -g rg-ai --query "[?kind=='OpenAI'].{Name:name, Endpoint:properties.endpoint, Location:location}" -o table
Name Endpoint Location
chatgpt https://chatgpt.openai.azure.com/ eastus
gpt4 https://gpt4.openai.azure.com/ westeurope
A
Use Azure PowerShell Get-AzCognitiveServicesAccount cmdlet
Why wrong: PowerShell is an alternative but not the most reliable for this specific scenario.
B
Parse the table output using string manipulation
Why wrong: Parsing table output is less reliable than using structured queries.
C
Use az cognitiveservices account show with --query to filter by name
Using --query with JMESPath provides a reliable way to extract specific values.
D
Deploy a new Azure OpenAI resource with a known endpoint
Why wrong: Deploying a new resource is not necessary.
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Use az cognitiveservices account show with --query to filter by name
Option C is correct because `az cognitiveservices account show` with the `--query` parameter allows you to retrieve the specific endpoint property for a named resource using JMESPath filtering. This approach is reliable, scriptable, and avoids parsing unstructured output, which is error-prone. The Azure CLI returns structured JSON, and `--query` extracts the exact value without manual string manipulation.
Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
✗
Use Azure PowerShell Get-AzCognitiveServicesAccount cmdlet
Why it's wrong here
PowerShell is an alternative but not the most reliable for this specific scenario.
✗
Parse the table output using string manipulation
Why it's wrong here
Parsing table output is less reliable than using structured queries.
✓
Use az cognitiveservices account show with --query to filter by name
Why this is correct
Using --query with JMESPath provides a reliable way to extract specific values.
Related concept
Read the scenario before looking for a memorised answer.
✗
Deploy a new Azure OpenAI resource with a known endpoint
Why it's wrong here
Deploying a new resource is not necessary.
Common exam traps
Common exam trap: answer the scenario, not the keyword
The trap here is that candidates may default to parsing the default table output (Option B) because it looks human-readable, but the exam tests understanding that structured JSON queries are the reliable, production-grade method for programmatic access.
Trap categories for this question
Command / output trap
Parsing table output is less reliable than using structured queries.
Scenario analysis trap
PowerShell is an alternative but not the most reliable for this specific scenario.
Detailed technical explanation
How to think about this question
The Azure CLI `az cognitiveservices account show` command returns a JSON object containing properties like `properties.endpoint`. Using `--query "properties.endpoint"` extracts the exact endpoint string via JMESPath, a query language for JSON. This method is idempotent and works across different output formats (json, table, tsv), making it ideal for automation scripts that need to store the endpoint in a variable or pass it to another tool.
KKey Concepts to Remember
Read the scenario before looking for a memorised answer.
Find the constraint that changes the correct option.
Eliminate answers that are true in general but not in this case.
TExam Day Tips
→Watch for words such as best, first, most likely and least administrative effort.
→Review why wrong options are wrong, not only why the correct option is correct.
Key takeaway
Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Real-world example
How this comes up in practice
A company's IT admin needs to give a contractor read-only access to production logs without sharing account credentials. Using role-based access control (RBAC) and temporary scoped permissions — not a permanent shared password — is the correct pattern. Questions like this test whether you can apply least-privilege access across cloud identity services.
What to study next
Got this wrong? Here's your next step.
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
Plan and manage an Azure AI solution — This question tests Plan and manage an Azure AI solution — Read the scenario before looking for a memorised answer..
What is the correct answer to this question?
The correct answer is: Use az cognitiveservices account show with --query to filter by name — Option C is correct because `az cognitiveservices account show` with the `--query` parameter allows you to retrieve the specific endpoint property for a named resource using JMESPath filtering. This approach is reliable, scriptable, and avoids parsing unstructured output, which is error-prone. The Azure CLI returns structured JSON, and `--query` extracts the exact value without manual string manipulation.
What should I do if I get this AI-102 question wrong?
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
What is the key concept behind this question?
Read the scenario before looking for a memorised answer.
About these practice questions
Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
This AI-102 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 AI-102 exam.
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
Sign in to join the discussion.