You are writing a C# method using the Azure SDK for .NET (`Azure.Storage.Blobs`) to set custom metadata on an existing block blob. You need to add a custom metadata name-value pair where the key is `Department` and the value is `Engineering`.
Which key-value pair should you add to the metadata dictionary passed to the `BlobClient.SetMetadataAsync` method?
- "Department" as the key and "Engineering" as the valueAnswer
- B"x-ms-meta-Department" as the key and "Engineering" as the value
- C"Department" as the key, "Engineering" as the value, and the active lease ID as a metadata key named "LeaseId"
- D"Department" as the key and "Engineering" as the value, configured on a BlobSasBuilder object
Answer
Provide "Department" as the key and "Engineering" as the value in the metadata dictionary.
When using the Azure SDK for .NET, developers work with raw keys and values because the SDK automatically adds the protocol-required 'x-ms-meta-' prefix to the HTTP headers before sending the request to the Azure Storage service.
Step-by-Step Solution
Key Concept
Azure SDK for .NET automatically prepends the 'x-ms-meta-' header prefix to keys in the metadata dictionary, so developers must only supply the raw key name.