question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How do I determine if a storage container or blob exists?

See original GitHub issue

In older versions of the Azure SDK for Python, I could call BaseBlobService.exists() to check if a container or blob exists.

I don’t see any equivalent function in the documentation for BlobServiceClient, ContainerClient or BlobClient. The functions to create/overwrite a container or blob will throw an error if the object already exists, but there are times when I just want to verify something exists without modifying it.

What is the correct way to check if a blob exists in azure-storage-blob v12+?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

6reactions
tasherif-msftcommented, Sep 9, 2020

Hi @dharmab the exists method has been added to our SDK and will be available in this upcoming release!

2reactions
xiafu-msftcommented, Jul 28, 2020

Hi @dharmab

Thanks for reaching out! Currently you can use blob_client.get_blob_properties() and it will throw ResourceNotFoundError if the blob/container/blob_snapshot doesn’t exist.

We have an feature request to add exists() api, so users will be less confused about this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do you check that a container exists in Azure Blob ...
In v12, there are 2 ways to check if the container exists or not. 1. BlobServiceClient blobServiceClient = new ...
Read more >
BlobContainerClient.Exists(CancellationToken) Method
The Exists(CancellationToken) operation can be called on a BlobContainerClient to see if the associated container exists on the storage account in the ...
Read more >
Checking if a blob exists in Azure Storage - Intellipaat
I just want to know whether a blob exists in a particular container or not. Simple question right! ... research but it seems...
Read more >
How to Detect and Compromise Azure Blobs and Storage ...
A quick way to check if these logs are enabled is by going into the Azure Portal and viewing the containers within a...
Read more >
Azure: Checking if a blob exists using its URI
Having only a storage account ( CloudBlobClient ) and a blob URI makes it a little bit tricky to check if the blob...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found