AZ-204 Case Studies & Practical Application 4 — Questions and Answers
Question 1: A developer needs to push IoT device data to 500 downstream consumers in real time with minimal latency. Individual consumers need to replay events from the last 7 days. Which Azure service is the best fit?
- Azure Event Hubs with a 7-day retention period (Correct answer)
- Azure Service Bus Topics with 500 subscriptions
- Azure Event Grid with a custom topic
- Azure Storage Queue with 500 reader clients
Correct answer: Azure Event Hubs with a 7-day retention period
Event Hubs is designed for high-throughput event streaming with configurable retention and consumer group replay, supporting thousands of concurrent consumers.
Question 2: A company's App Service web app must access an internal SQL Server hosted on-premises without exposing it to the public internet. What is the recommended connectivity option?
- Configure Hybrid Connections on the App Service to reach the on-premises SQL Server (Correct answer)
- Whitelist the App Service outbound IPs in the on-premises firewall
- Use Azure VPN Gateway with site-to-site VPN and VNet Integration
- Deploy an Azure Application Gateway in front of the SQL Server
Correct answer: Configure Hybrid Connections on the App Service to reach the on-premises SQL Server
Hybrid Connections use an outbound TCP relay via Service Bus, requiring no inbound firewall rules and no VNet, making it the simplest option for App Service to on-premises connectivity.
Question 3: A developer needs to implement optimistic concurrency for updates to an Azure Cosmos DB document. Which approach should be used?
- Use the _etag property and pass it as an AccessCondition with IfMatch on each update request (Correct answer)
- Use the document's id field as a lock token before updating
- Enable multi-master writes and let the conflict resolution policy handle it
- Wrap the update in a stored procedure that checks a custom version field
Correct answer: Use the _etag property and pass it as an AccessCondition with IfMatch on each update request
Cosmos DB's _etag enables optimistic concurrency; the IfMatch header causes the operation to fail with a 412 if another process has modified the document since it was read.
Question 4: A containerized API on Azure Container Apps is returning 503 errors under load. The developer checks metrics and sees the replica count has reached the maximum of 10 but CPU is at 95%. What should be changed first?
- Increase the maximum replica count and review CPU-based scaling rules (Correct answer)
- Add a health probe with a longer initialDelaySeconds
- Switch to an Azure Kubernetes Service cluster for better scaling
- Enable Dapr sidecar to offload service-to-service communication overhead
Correct answer: Increase the maximum replica count and review CPU-based scaling rules
When replicas are at max and CPU is saturated, increasing the replica ceiling and verifying scaling triggers are correctly configured is the immediate action to restore capacity.
Question 5: A developer implements retry logic for an Azure Blob Storage SDK call using an exponential backoff strategy. Calls are failing with HTTP 409 (Conflict) errors. Should 409 be retried?
- No; 409 indicates a conflict condition that won't resolve by retrying—handle it explicitly in application logic (Correct answer)
- Yes; exponential backoff with jitter will eventually resolve the conflict
- Yes, but only after a 30-second fixed delay
- No; 409 indicates the client is throttled and should switch to a different storage account
Correct answer: No; 409 indicates a conflict condition that won't resolve by retrying—handle it explicitly in application logic
HTTP 409 Conflict in Blob Storage (e.g., lease conflict or blob already exists) is a business-logic error that retrying will not resolve—it requires explicit handling.
Question 6: An Azure API Management gateway must transform an XML response from a legacy SOAP backend into JSON before returning it to REST clients. Which APIM policy accomplishes this?
- xml-to-json in the outbound policy section (Correct answer)
- set-body with a Liquid template in the outbound section
- rewrite-uri to change the content-type header
- transform-xml using an XSLT stylesheet in the inbound section
Correct answer: xml-to-json in the outbound policy section
The xml-to-json APIM policy in the outbound section automatically converts the XML response body to JSON before it reaches the REST client.
Question 7: A developer must ensure that messages published to an Azure Service Bus topic are processed in strict FIFO order by a single consumer. What must be configured?
- Enable sessions on the topic subscription and use a session-aware receiver with a consistent session ID (Correct answer)
- Set the subscription's lock duration to 5 minutes to prevent concurrent processing
- Use a single partition on the topic to guarantee ordering
- Set MaxConcurrentCalls to 1 on the consumer host
Correct answer: Enable sessions on the topic subscription and use a session-aware receiver with a consistent session ID
Service Bus sessions group related messages under a session ID, and a session-aware receiver processes them sequentially, guaranteeing FIFO order within a session.
A developer needs to push IoT device data to 500 downstream consumers in real time with minimal latency.
Individual consumers need to replay events from the last 7 days.
Which Azure service is the best fit?