Question

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

You are developing a .NET application to move log files between two different Azure Storage accounts. You write the following code using the Azure.Storage.Blobs SDK to copy a blob:

csharp
// Source blob client and destination blob client are initialized.
var sourceBlobClient = sourceContainerClient.GetBlobClient("logs/app.log");
var destBlobClient = destContainerClient.GetBlobClient("archive/app.log");

// Generate source URI with a SAS token.
Uri sourceUri = GetSourceUriWithSas(sourceBlobClient);

// Start the copy operation.
CopyFromUriOperation operation = await destBlobClient.StartCopyFromUriAsync(sourceUri);

// Poll for completion.
await operation.WaitForCompletionAsync();

Which configuration or behavior is correct regarding the SAS token permissions and blob properties for this operation?

  1. The source SAS token only needs the Read ('r') permission, and all user-defined metadata is copied to the destination by default.Answer
  2. B
    The source SAS token must include both Read ('r') and Write ('w') permissions to allow the destination storage service to write the copy to the destination container.
  3. C
    If the source blob has an active lease, the operation will fail unless you pass the active lease ID of the source blob to the StartCopyFromUriAsync method.
  4. D
    Any user-defined metadata on the source blob will be lost unless the metadata keys are prefixed with 'x-ms-meta-' and converted to lowercase prior to the copy.

Answer

The source SAS token only needs the Read ('r') permission, and all user-defined metadata is copied to the destination by default.
The correct answer states that the source SAS token only needs the Read ('r') permission, and all user-defined metadata is copied to the destination by default. During an asynchronous copy operation initiated by the destination BlobClient, the target storage account accesses the source URI to read the blob. Consequently, the SAS token on the source URI only needs to grant read access. By default, metadata is copied over to the new blob without requiring manual prefixing or lowercase conversions.

Step-by-Step Solution

1
Analyze the access requirement for the source blob during a copy operation.
The destination storage account must read the source blob to retrieve its contents. Thus, only the Read ('r') permission is required on the source SAS token.
Since the copy destination is authorized separately (via the client credential for the destination), the source SAS token does not need Write permissions.
2
Analyze how leases affect copy operations on the source.
Leases prevent modifications and deletions. Since copying from a source is a read-only operation, a lease on the source does not block the copy.
You do not need to manage or supply the source lease ID for read-only actions.
3
Determine how metadata is handled during a copy.
All existing user-defined metadata is copied to the destination blob automatically.
Azure Storage preserves properties and metadata by default unless they are explicitly overridden in the copy request.

Key Concept

Blob copy operations using StartCopyFromUriAsync only require read access to the source blob via its SAS token, do not require lease clearance on the source, and preserve metadata automatically.
Rate this question