AZ-204 Develop for Azure storage Practice Question
You are designing a solution that requires atomic operations on a counter stored in Azure Blob Storage. The counter must be updated by multiple instances without conflicts. Which approach should you use?
⚠ Common exam trap
Many candidates assume Azure Blob Storage's lease or append features can provide atomicity, but Blob Storage lacks server-side atomic read-modify-write operations, making Cosmos DB the only Azure service among the options that natively supports atomic counter updates with stored procedures.
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
✓
Store the counter in Azure Cosmos DB and use stored procedures to increment atomically.
Azure Cosmos DB stored procedures execute within the database engine's transactional scope, providing ACID-compliant atomic operations. This ensures that concurrent increments from multiple instances are serialized without conflicts, which is not natively supported by Azure Blob Storage's eventual consistency model.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Store the counter in Azure Cosmos DB and use stored procedures to increment atomically.
Why this is correct
Azure Cosmos DB stored procedures execute as a single, ACID-compliant transaction within a logical partition. When a stored procedure increments a counter, all operations within that procedure—reading the current value, incrementing it, and writing the new value—are guaranteed to either fully succeed or fully fail. This transactional boundary ensures that concurrent attempts to update the counter will not result in lost updates, making the increment operation truly atomic.
- ✗
Use Azure Queue Storage to queue increment messages.
Why it's wrong here
Azure Queue Storage is primarily a messaging service designed for decoupling components and facilitating asynchronous communication. While it can store messages indicating an increment, it does not inherently provide a mechanism for atomically updating a shared counter. A separate consumer process would need to read these messages and then attempt to update a counter stored elsewhere, introducing potential race conditions and requiring additional logic (like distributed locks or transactional updates in the target store) to ensure atomicity.
- ✗
Store the counter in Azure Table Storage and use optimistic concurrency with ETags.
Why it's wrong here
Azure Table Storage supports optimistic concurrency control using ETags, which helps detect conflicts but does not guarantee atomicity for the update operation itself. When an ETag mismatch occurs, the update fails, requiring the client to retry the entire operation. This means the initial attempt was not atomic; the system state was not guaranteed to be consistent after the first try, and multiple retries might be necessary to achieve a successful update, which is not an atomic operation by definition.
- ✗
Use Append Blob to append each increment as a new block and sum them later.
Why it's wrong here
Append Blobs are optimized for append-only operations, such as logging, where new blocks are added to the end of the blob. While appending a single block is an atomic operation, the overall process of reading the current counter value, calculating a new value, and then appending it as a new block is not atomic. Furthermore, summing all blocks later to determine the current counter value introduces latency and potential inconsistencies if new appends occur concurrently, failing to provide an immediately consistent and atomic counter.
Quick reference
Azure Blob Storage Tier Comparison
| Tier | Storage Cost | Retrieval Cost | Latency | Use Case |
|---|---|---|---|---|
| Hot | Highest | Lowest | Immediate | Active data, frequent reads |
| Cool | Lower | Higher | Immediate | Data accessed < once / month |
| Cold | Lower still | Higher | Immediate | Data accessed < once / quarter |
| Archive | Lowest | Highest + rehydration delay | Hours | Long-term compliance retention |
Go deeper
Related to this question
About these practice questions
This AZ-204 question is part of Courseiva's 881-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam 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.