You are developing an application using the .NET Azure.Storage.Blobs SDK (version 12) to copy a blob from a source container to a destination container. The destination blob already exists and is locked with an active, exclusive write lease. You possess the lease ID for the destination blob. Which of the following approaches should you use to successfully perform the copy operation?
- Instantiate a BlobCopyFromUriOptions object, assign the lease ID to the LeaseId property of its DestinationConditions, and pass the options to StartCopyFromUriAsync.Cevap
- BInstantiate a BlobCopyFromUriOptions object, assign the lease ID to the LeaseId property of its SourceConditions, and pass the options to StartCopyFromUriAsync.
- CAcquire an identical lease on the source blob using the destination blob's lease ID before calling StartCopyFromUriAsync without copy options.
- DGenerate a Shared Access Signature (SAS) token for the destination container containing the lease ID, and append this token to the destination blob's URI.
Cevap
Instantiate a BlobCopyFromUriOptions object, assign the lease ID to the LeaseId property of its DestinationConditions, and pass the options to StartCopyFromUriAsync.
The option stating to instantiate a BlobCopyFromUriOptions object and assign the lease ID to its DestinationConditions is correct because it ensures that the active write lease on the destination blob is authorized during the write operation. The Azure Storage service validates this lease ID against the active lease on the destination blob to allow the copy operation to overwrite it.
Adım Adım Çözüm
Anahtar Kavram
Using BlobCopyFromUriOptions and DestinationConditions to overwrite a leased destination blob during a copy operation.