Connect to and consume Azure services and third-party services →mediumMultiple ChoiceObjective-mapped
AZ-204 Practice Question: Connect to and consume Azure services and third-party services
Your company is building a real-time dashboard that displays sales data from multiple stores. The data is generated as events from point-of-sale systems and must be ingested with low latency. The dashboard needs to display aggregated data (e.g., total sales per store per minute) with a maximum delay of 5 seconds from event generation. You have decided to use Azure Event Hubs for ingestion and Azure Stream Analytics for real-time processing. The processed data will be stored in Azure Cosmos DB for the dashboard to query. However, the dashboard requires that the data in Cosmos DB be updated as soon as new aggregations are available. You need to design the output from Azure Stream Analytics to Cosmos DB. Which output configuration should you use?
⚠ Common exam trap
Watch out — candidates often think any Cosmos DB API works the same way, but only the SQL API (and Table API with specific row key design) supports native upsert from Stream Analytics, and the MongoDB API does not have a direct output adapter in Stream Analytics.
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
✓
Configure the output to use Cosmos DB SQL API with the document ID set to a concatenation of store ID and minute timestamp, and enable upsert.
It uses the Cosmos DB SQL API with a document ID that uniquely identifies each aggregation (store ID + minute timestamp), and enables upsert. This ensures that when Stream Analytics emits a new aggregation for the same store and minute, it overwrites the existing document, providing low-latency updates to the dashboard. The SQL API supports native upsert semantics, which is the most direct and efficient way to achieve real-time updates without additional services or complex logic.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Configure the output to use Cosmos DB MongoDB API and use a unique index on store ID and timestamp.
Why it's wrong here
While Azure Cosmos DB's MongoDB API supports upsert operations, its underlying implementation and indexing strategy might introduce slightly higher latency compared to the native SQL API for highly frequent, targeted updates required by a real-time dashboard. The overhead of translating MongoDB queries to Cosmos DB's native engine can impact performance for scenarios demanding millisecond-level consistency and low-latency writes, making it less optimal for this specific real-time use case.
- ✗
Output to Azure Cosmos DB Table API with a partition key of store ID.
Why it's wrong here
Azure Cosmos DB Table API is primarily designed for high-throughput, low-latency key-value lookups, making it unsuitable for real-time aggregation queries. It lacks native support for complex query operators or server-side aggregation functions, meaning any aggregation would need to be performed client-side after retrieving all relevant data, which is inefficient and introduces significant latency for a real-time dashboard.
- ✗
Write the output to Azure Blob Storage and use an Azure Function triggered by blob creation to update Cosmos DB.
Why it's wrong here
Writing output to Azure Blob Storage and then using an Azure Function to update Cosmos DB introduces multiple points of latency and increased complexity. The asynchronous nature of blob creation triggers and the additional network hops, processing time within the Function, and subsequent write to Cosmos DB would prevent the dashboard from displaying truly real-time updates, failing to meet the core requirement.
- ✓
Configure the output to use Cosmos DB SQL API with the document ID set to a concatenation of store ID and minute timestamp, and enable upsert.
Why this is correct
Configuring the output to use Azure Cosmos DB SQL API with a document ID concatenated from the store ID and minute timestamp, combined with enabling upsert, is the most efficient solution. This approach allows for direct, low-latency updates or insertions of specific minute-level data for each store, leveraging the SQL API's native document model and optimized upsert functionality for real-time data processing.
Go deeper
Related to this question
About these practice questions
Courseiva writes every AZ-204 question from scratch — 881 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-204 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-204 exam.