Error while permanent deleting soft deleted blob through rest API

755 Views Asked by At

Please help with error PermanentDeleteNotSupportedOnRootBlob

I generated SAStoken for BLOB with all permissions including Delete & Permanent Delete

While making API call using below blog https://learn.microsoft.com/en-us/rest/api/storageservices/delete-blob

request url: "https://[SAS URL]&deletetype=permanent"

Getting 409 error as "PermanentDeleteNotSupportedOnRootBlob" responeerror

x-ms-delete-snapshots in the header is "include"

Storage Account - 'Permanent Delete soft deleted blobs' option is enabled enter image description here

Google does not return anything for PermanentDeleteNotSupportedOnRootBlob

Also tried with both Signing method as Account key & User delegation key and got same error

1

There are 1 best solutions below

2
On

I tried to reproduce the same in my environment.

To permanently delete blob , their snapshot must also be soft deleted For that Make sure to enable versioning for blobs while creating.

enter image description here

If already created, you can enable version from data protection configuration.

enter image description here

With

https://xxxx.blob.core.windows.net/container/blob?sp=r&st=2023-01-27T12:43:35Z&se=2023-01-27T20:43:35Z&spr=https&sv=2021-06-08&sr=b&sig=xxxx%3D&deletetype=permanent

The blob can be deleted successfully

Note:

  1. Make sure the versionId is given correctly.
  2. For already existing blob, disable soft delete , undelete the blobs then enable all the above mentioned properties and delete again.

Otherwise one may come across 409 error.

enter image description here

Reference: Delete Blob (REST API) -permanent-delete Azure Storage | Microsoft Learn