[BUG] Cannot delete single Blob Storage snapshot
See original GitHub issueLibrary name and version
Azure.Storage.Blobs 12.8.0
Describe the bug
I can create a snapshot, but the SDK only allows me to delete all snapshots for a given blob item, not the one I specified. In general, the SDK usability of blob storage snapshots is very poor.
Expected behavior
Expected to be able to specify deleting a single snapshot
Actual behavior
Can only delete all snapshots
Reproduction Steps
BlobContainerClient blobContainerClient = new BlobContainerClient(/* auth */);
BlobClient blobClient = blobContainerClient.GetBlobClient("foo");
Response<BlobSnapshotInfo> snapshot = blobClient.CreateSnapshot();
blobClient.Delete(DeleteSnapshotsOption.OnlySnapshots); // no overload to specify a single snapshot
blobClient.WithSnapshot(snapshot.Value.Snapshot).Delete(); // returns BadRequest since this operation is only allowed on the base blob, not a snapshot
Environment
Developing .NET Standard 2.1 library project in Visual Studio 2019 on Windows 11, deploying to Azure AppService for Linux
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:9 (3 by maintainers)
Top Results From Across the Web
deleting from azure blob - Microsoft Q&A
Delete Blob : The Delete Blob operation marks the specified blob or snapshot for deletion. The blob is later deleted during garbage collection....
Read more >Can an Azure container with a blob that has a snapshot be ...
I know that an Azure blob with snapshots cannot be deleted until all the snapshots are deleted. Would it be possible, though, to...
Read more >Fix: unable to delete an Azure Storage Container due to a lease.
A quick tip for anyone who gets stuck when trying to delete an Azure Blob Storage Container that appears to be empty but...
Read more >How to recover accidental deletes in Azure Blob Storage
This article covers soft delete feature in Azure Blob Storage to recover data that is accidentally deleted in blobs or blob snapshots.
Read more >Delete an Amazon EBS snapshot - AWS Documentation
Delete a snapshot of an Amazon EBS volume using the AWS Management Console, ... Deleting a snapshot might not reduce your organization's data...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@aaronpburke - it’s possible, though not very obvious with the supplied documentation.
The key is to get yourself the
snapshotClient
instead of theblobClient
- then just perform the same actions you would as if it were a regular blob.From the rest api documentation:
Closing the issue, please reopen if the sample above does not resolve the issue.