Question

Difficulty: EasyManage Properties, Metadata, and Access Tiers for Azure Blob Storage

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?

  1. "Department" as the key and "Engineering" as the valueAnswer
  2. B
    "x-ms-meta-Department" as the key and "Engineering" as the value
  3. C
    "Department" as the key, "Engineering" as the value, and the active lease ID as a metadata key named "LeaseId"
  4. 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

1
Determine how the Azure SDK for .NET manages metadata HTTP header formatting.
The SDK automatically handles the REST protocol details, including prepending the required 'x-ms-meta-' prefix to custom metadata key-value pairs.
This simplifies developer usage by allowing the use of clean, simple key strings in code.
2
Select the dictionary configuration containing only the raw metadata key and value.
Using the key 'Department' with the value 'Engineering'.
This avoids double-prefix errors and formats the request correctly for Azure Blob Storage.

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.
Rate this question