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?
- The source SAS token only needs the Read ('r') permission, and all user-defined metadata is copied to the destination by default.Answer
- BThe 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.
- CIf 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.
- DAny 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.