Azure Blob Storage – Access Tiers, Lifecycle and Leases · AZ-204: Developing Solutions for Microsoft Azure Develop for Azure Storage
A .NET application acquires a 30-second lease on an existing block blob and receives leaseId. Another client must not update or delete the blob while…
Practice question from Azure Blob Storage – Access Tiers, Lifecycle and Leases (AZ-204: Developing Solutions for Microsoft Azure Develop for Azure Storage), with the correct answer and a step-by-step solution.
hard · MCQ · Q-F27155
A .NET application acquires a 30-second lease on an existing block blob and receives leaseId. Another client must not update or delete the blob while the lease is active. Which code correctly uploads new content while honoring the lease?
- A.await blobClient.UploadAsync(BinaryData.FromString("new content"), new BlobUploadOptions { Conditions = new BlobRequestConditions { LeaseId = leaseId } });Correct answer
- B.await blobClient.UploadAsync(BinaryData.FromString("new content"), new BlobUploadOptions { AccessTier = AccessTier.Cool });
- C.await blobClient.SetAccessTierAsync(AccessTier.Cool);
- D.await blobClient.DeleteAsync(); await blobClient.UploadAsync(BinaryData.FromString("new content"));
Solution
A write to a blob with an active lease must include the lease ID in the request conditions. BlobRequestConditions.LeaseId supplies that ID. Changing the access tier does not authorize a write, and deleting the blob also requires the lease ID.
More from Azure Blob Storage – Access Tiers, Lifecycle and Leases
- A compliance application stores audit blobs that are rarely accessed. The organization must retain them for seven years and can wait severa…
- A storage account contains block blobs under the logs/ prefix. The requirement is to move each blob to Cool after 30 days since its last mo…
- A customer-support application must download a blob within seconds, but the blob is currently stored in the Archive tier. What should the a…
- A storage account must move blobs to the Cool tier after they have not been accessed for 14 days. The lifecycle policy should use the time…
Practise more Develop for Azure Storage
Sign up free for adaptive practice on this chapter, with instant feedback and hints on every question.
Start practising freeFree to start · No credit card needed