Azure Storage, list all blobs via REST API

Simon Magrin 6 Reputation points
2022-05-18T06:33:20.177+00:00

Hi, I'm trying to use the REST API to read (GET) all blobs in a container, eg:

https://stackoverflow.com/questions/56774567/rest-api-to-azure-blob-storage-using-access-key

Using the 'Authorization' as 'SharedKey myaccount:blabla==' as one of two access keys, but get this auth. error. I can upload (PUT) fine.

Any tips/advice? Thanks

203076-image.png

203017-image.png

203092-image.png

Azure Storage Accounts
Azure Storage Accounts
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
2,606 questions
Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,368 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Sumarigo-MSFT 43,001 Reputation points Microsoft Employee
    2022-05-18T09:37:37.64+00:00

    @Simon Magrin Welcome to Microsoft Q&A Forum, Thank you for posting your query here!

    I was able to repro the issue as mentioned in this article: https://learn.microsoft.com/en-us/rest/api/storageservices/list-blobs
    Can you try to refer the shared key(Access key) and try again . I was able to list all the details

    203135-image.png

    203166-image.png

    Please let us know if you have any further queries. I’m happy to assist you further.

    ----------

    Please do not forget to 203089-screenshot-2021-12-10-121802.png and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.

    0 comments No comments

  2. Simon Magrin 6 Reputation points
    2022-05-18T10:35:00.167+00:00

    Hi @Sumarigo-MSFT, thanks for responding.

    Still not working for me I'm afraid:

    203139-image.png

    Basically I've done the following:

    • Storage account allows my source IP address and selected VNET's
    • Querying a container that's set to Private (no anonymous access)
    • For the Params, the key's and values are defined in the 'GET' URL
    • For the Headers > 'Authorization', e.g.: 'SharedKey mystorageaccount:blablabla==' as the value

    I've tried rotating the keys, disabling the firewall, including the 'x-ms-date' in the Headers as the current GMT time, specified the 'x-ms-version', and repeated these with another storage account (publicly accessible), all to no avail.

    Is there something that I'm missing? Also, I can see in your Postman screenshot that you might've configured something in the [Authorization] tab perhaps? Mine is set to 'No Auth'. I can achieve the desired outcome with the Python SDK:

    203197-image.png

    Which regained some sanity, but for my objective and usually my first preference, I'd rather use the REST API to make this environment agnostic. Thanks!

    0 comments No comments

  3. Simon Magrin 6 Reputation points
    2022-05-18T13:20:38.397+00:00

    Thanks @Sumarigo-MSFT for your help earlier, greatly appreciate it.

    I got the REST API to work by unchecking the Authorization key under 'Headers' within Postman.

    203180-2022-05-18-23-13-32-clipboard.png

    However it only works when then the container is set to public, which isn't suitable in situations where the Storage account's containers are not publicly accessible.

    0 comments No comments