Question

Difficulty: MediumMove and Copy Blobs between Azure Storage Containers and Accounts

You are developing a C# utility to copy a blob named db-backup.bak from a source container to a destination container in a different Azure Storage account using the Azure.Storage.Blobs SDK. The source blob is private. The destination container already contains a blob named db-backup.bak that has an active lease. You need to initiate the copy asynchronously from the destination client and ensure the operation succeeds. Which configuration must you use for the copy operation?

  1. Provide a source SAS token with Read (r) permission in the source URI, and specify the active lease ID in the DestinationConditions property of BlobCopyFromUriOptions.Answer
  2. B
    Provide a source SAS token with Read (r) and Write (w) permissions in the source URI, and specify the active lease ID in the SourceConditions property of BlobCopyFromUriOptions.
  3. C
    Provide a source SAS token with Read (r) permission in the source URI, and include user-defined metadata in the copy options using headers that omit the x-ms-meta- prefix.
  4. D
    Provide a source SAS token with Write (w) permission in the source URI, and initiate the copy from the source BlobClient without supplying any destination conditions.

Answer

Provide a source SAS token with Read (r) permission in the source URI, and specify the active lease ID in the DestinationConditions property of BlobCopyFromUriOptions.
The correct option correctly identifies that the source SAS token needs Read (r) permission because the copy engine must read the source blob. It also properly configures DestinationConditions with the active lease ID to allow overwriting the leased destination blob.

Step-by-Step Solution

1
Determine the source SAS token permissions.
The source blob is private and must be read by the destination service. Therefore, the source SAS token must contain at least Read (r) permission.
The copy process reads from the source URI, so read access is necessary and sufficient.
2
Address the active lease on the destination blob.
Since the destination blob is leased, writing to it requires passing the lease ID via the DestinationConditions property of BlobCopyFromUriOptions.
Setting the lease ID in the destination conditions authorizes the write operation on the leased blob.
3
Select the option that combines both configurations.
The option specifying Read permission for the source SAS and DestinationConditions for the destination lease ID is correct.
This configuration satisfies both authorization and lease requirements.

Key Concept

Asynchronous blob copying using Azure.Storage.Blobs SDK requires proper source SAS read permissions and destination lease conditions if the target blob is leased.
Rate this question