You are developing a .NET console application that uses the Azure.Storage.Blobs SDK to migrate security logs from a private container in a source storage account to a container in a destination storage account. The source storage account has public access disabled, and the migration must be done programmatically. Which two actions should you perform to copy the log blob to the destination storage account?
- Generate a Shared Access Signature (SAS) token for the source blob that includes only the Read permission.Answer
- Call StartCopyFromUriAsync on the destination BlobClient instance and pass the source blob URI with the SAS token.Answer
- CGenerate a Shared Access Signature (SAS) token for the source blob that includes Write, Delete, and List permissions.
- DSet the metadata on the destination blob by prefixing each custom metadata key with X-MS-META- in uppercase letters.
- EAcquire an exclusive lease on the source blob and pass the lease ID to the copy operation options to prevent other clients from reading it.
Answer
Generate a Shared Access Signature (SAS) token for the source blob that includes only the Read permission, and call StartCopyFromUriAsync on the destination BlobClient instance passing the source blob URI with the SAS token.
To copy a blob from a secure source container to a destination container in a different storage account, you must generate a Shared Access Signature (SAS) token on the source blob with at least Read permissions so that the destination service can read the source file. Then, you initiate the copy by calling StartCopyFromUriAsync on the destination BlobClient, passing the source blob's URI containing the SAS token.
Step-by-Step Solution
Key Concept
Asynchronous blob copying requires a source URI authenticated via a SAS token with Read permissions, and initiating the copy from the destination client using the SDK.