AZ-204 Quiz

Blob Storage

Question:

In the Azure Blob Storage .NET SDK, you want to ensure that you only update a blob if it has not been modified since you last fetched it. Here is the initial code you have:

BlobServiceClient blobServiceClient = new BlobServiceClient(connectionString);
BlobContainerClient containerClient = blobServiceClient.GetBlobContainerClient("mycontainer");
BlobClient blobClient = containerClient.GetBlobClient("myblob");

BlobProperties properties = await blobClient.GetPropertiesAsync();;

// perform the update
BlobUploadOptions options = new BlobUploadOptions
{
    Metadata = new Dictionary<string, string>
    {
        { "key", "value" }
    },
    // Fill in this part
};

await blobClient.UploadAsync(BinaryData.FromString("data"), options);


What should you put in the // Fill in this part section to ensure the blob is only updated if it has not been modified since you last fetched it?

Report a problem
Exam revision: April 11, 2025