i am getting an error while using azure stprage blob sdk while undeleting a container which is deleted.
These are the package versions i am using:
azure-storage-blob = "=12.18.3" azure-mgmt-storage = "=21.1.0"
i have created the blobserviceclient and calling undelete_container function to recover a deleted container.
Create the BlobServiceClient object
blob_service_client = BlobServiceClient(storage_account_url, credential=default_credential)
recovered_containers = blob_service_client.undelete_container(container_name, deleted_container_version = '')
the issue i am facing is "deleted_container_version" is a mandatory parameter for undelete_container. but i dont know what is the value to be provided. This is defined as a string parameter.
What should be the value i neeed to pass?
this is the properties i see on deleted container.
please guide me in fixing this. Thank you in advance
i did tried with deleted_container_version as an empty string, latest values, without passing.
while not passing deleted_container_version getting an error stating deleted_container_version is a mandatory parameter and needs to be passed.
while passing them as empty string or latest, getting an error stating the header version was an invalid value or something like that,
I agree with KKI's comment to get the deleted containers first list the container with
include_deleted=True
from that you can get the version of your container.To
undelete
particular containertest
from Azure blob storage you can use the below Python code.Code:
Output:
If you need to
undelete all
container you can use the below code.Code:
Output:
Reference:
List blob containers with Python - Azure Storage | Microsoft Learn