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?
- 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
- BProvide 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.
- CProvide 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.
- DProvide 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
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.