You are developing a C# application that manages document archiving using the Azure.Storage.Blobs SDK (version 12). You write the following helper method to process and archive blobs:
csharp
public static async Task ArchiveBlobAsync(BlobClient blobClient, string user)
{
// Retrieve existing properties
BlobProperties properties = (await blobClient.GetPropertiesAsync()).Value;
// Check if the blob has a classification
if (properties.Metadata.ContainsKey("Classification"))
{
Console.WriteLine($"Classification: {properties.Metadata[\"Classification\"]}");
}
// Add the archival metadata
var metadata = new Dictionary<string, string>
{
{ "ArchivedBy", user }
};
await blobClient.SetMetadataAsync(metadata);
// Transition the blob to the Cool tier
await blobClient.SetAccessTierAsync(AccessTier.Cool);
}
Which of the following statements regarding the behavior or issues in this code are correct? (Select TWO)
- The check properties.Metadata.ContainsKey("Classification") will evaluate to false even if a metadata key named "Classification" exists on the blob, because Azure Blob Storage returns metadata keys in lowercase.Cevap
- Calling SetMetadataAsync(metadata) will clear all existing custom metadata on the blob, leaving only the "ArchivedBy" metadata key.Cevap
- CTo read the metadata key correctly, the code must check for the "x-ms-meta-Classification" key because the SDK retains the HTTP header prefix in the Metadata dictionary.
- DThe SetMetadataAsync method will automatically bypass any active exclusive-write leases on the blob without requiring a lease ID, because metadata updates do not modify the actual binary content of the blob.