A C# application updates the custom metadata of an Azure Blob Storage block blob that has an active write lease. You are using the Azure.Storage.Blobs SDK (version 12) to add a metadata key-value pair of 'status' and 'processed'. Which of the following actions are required to complete this operation successfully without triggering exceptions? (Select TWO)
- Pass the lease ID within a BlobRequestConditions object to the SetMetadataAsync method.Answer
- Exclude the x-ms-meta- prefix from the key name in the metadata dictionary.Answer
- CInclude the x-ms-meta- prefix as part of the key name in the metadata dictionary.
- DCall SetMetadataAsync without specifying a lease ID, since leases only restrict binary content changes.
Answer
To successfully update the metadata of a leased blob, you must pass the lease ID within a BlobRequestConditions object to the SetMetadataAsync method, and you must exclude the x-ms-meta- prefix from the metadata dictionary key names.
Updating metadata on a leased blob requires verifying ownership of the lease by passing the lease ID in a BlobRequestConditions object to the SetMetadataAsync method. Additionally, the SDK automatically prepends the required 'x-ms-meta-' header prefix to keys in the metadata dictionary, so developers must define keys without this prefix.
Step-by-Step Solution
Key Concept
Updating metadata on leased blobs requires passing the active lease ID using BlobRequestConditions and specifying dictionary keys without the x-ms-meta- prefix.