Microsoft Azure Developer Associate AZ-204 Practice Question
A .NET 6 console application receives files as Stream objects and must store each file in Azure Blob Storage by using the Azure.Storage.Blobs 12.x SDK. The solution must meet these requirements:
Upload the stream as a block blob.
Throw an exception if a blob with the same name already exists.
Support cancellation through a provided CancellationToken.
Do not overwrite an existing blob by using the convenience overwrite parameter. Which code approach should you use?
Calling BlobClient.UploadAsync and passing the stream together with a BlobUploadOptions that contains a BlobRequestConditions object whose IfNoneMatch property is set to "*" satisfies all the requirements. The IfNoneMatch condition instructs the service to perform the upload only when no blob currently exists with the same name; otherwise, the service returns status code 412 and the SDK surfaces a RequestFailedException. Because UploadAsync uploads the data from the supplied stream and accepts a CancellationToken parameter, the cancellation requirement is also met. The other options either overwrite existing blobs, require manual block staging, or copy from a URI rather than from the incoming stream.
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 Azure Blob Storage?
Open an interactive chat with Bash
What does the IfNoneMatch condition do?
Open an interactive chat with Bash
How does a CancellationToken work in asynchronous operations?
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 .