You are developing a C# application that uses the Azure.Storage.Blobs SDK (v12) to manage files in Azure Blob Storage. You need to delete a blob that currently has an active, exclusive-write lease. Which two actions can you perform to successfully delete the blob? (Select two.)
- Call the DeleteAsync method on the BlobClient and pass the active lease ID in a BlobRequestConditions object.Cevap
- Instantiate a BlobLeaseClient for the blob, call BreakAsync to release the lease lock, and then call DeleteAsync on the BlobClient.Cevap
- CCall the DeleteAsync method on the BlobClient directly without specifying a lease ID, as leases only block write operations.
- DInstantiate a BlobLeaseClient for the blob, call AcquireAsync to acquire a new lease, and then call DeleteAsync on the BlobClient without specifying a lease ID.
Cevap
To delete a leased blob, you must either provide the active lease ID using a BlobRequestConditions object when calling DeleteAsync, or break the active lease using a BlobLeaseClient before calling DeleteAsync.
To delete a blob that has an active lease, you can either provide the lease ID in the request conditions using a BlobRequestConditions object, or release/break the lease lock on the blob using a BlobLeaseClient prior to deletion. Both methods satisfy the requirements for modifying or deleting a leased resource in Azure Storage.
Adım Adım Çözüm
Anahtar Kavram
Handling write/delete operations on leased blobs using the Azure.Storage.Blobs SDK.