Microsoft Azure Developer Associate AZ-204 Practice Question
You are developing an Azure Functions app that uses the Azure Cosmos DB .NET v3 SDK. The Orders container is partitioned on /categoryId. For a new checkout event, you must create one Order document and update the associated CategorySummary document that shares the same categoryId. Both changes must either succeed or fail together in a single request from the function, and you prefer to avoid writing any server-side stored procedures. Which SDK feature should you use?
Wrap the two SDK calls inside a System.Transactions TransactionScope for automatic commit.
Call CreateItemAsync and ReplaceItemAsync inside a TransactionalBatch scoped to the categoryId partition key.
Invoke Container.ExecuteStoredProcedureAsync with a stored procedure that performs both operations.
Enable bulk execution and invoke CreateItemAsync and ReplaceItemAsync concurrently.
TransactionalBatch in the .NET SDK allows you to group multiple write operations that target the same partition key into a single, atomic request. When the batch executes, either all operations in the batch are committed or none are, meeting the all-or-nothing requirement without deploying server-side stored procedures. Bulk execution sends operations individually and does not guarantee atomicity. System.Transactions scopes are ignored by the Azure Cosmos DB SDK, so each call would be an independent request. Executing a stored procedure would satisfy the atomicity requirement but contradicts the stated preference to avoid server-side code.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is a TransactionalBatch in Azure Cosmos DB?
Open an interactive chat with Bash
What is a partition key in Cosmos DB, and why is it important?
Open an interactive chat with Bash
Why is System.Transactions TransactionScope not compatible with the Cosmos DB .NET SDK?
Open an interactive chat with Bash
Microsoft Azure Developer Associate AZ-204
Develop for Azure storage
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
Pass with Confidence.
IT & Cybersecurity Package
You have hit the limits of our free tier, become a Premium Member today for unlimited access.
Military, Healthcare worker, Gov. employee or Teacher? See if you qualify for a Community Discount.
Monthly
$19.99
$19.99/mo
Billed monthly, Cancel any time.
3 Month Pass
$44.99
$14.99/mo
One time purchase of $44.99, Does not auto-renew.
MOST POPULAR
Annual Pass
$119.99
$9.99/mo
One time purchase of $119.99, Does not auto-renew.
BEST DEAL
Lifetime Pass
$189.99
One time purchase, Good for life.
What You Get
All IT & Cybersecurity Package plans include the following perks and exams .