0
votes

We want to be able to give access to some users to a container that they can see a list of their files in the browser, click on them to read them.

I created a storage account. A container with public access and have created few blobs in a container and have set the container public access level to read.

enter image description here

But when I try to access that container in the browser I get the following error. I created a SAS token for it in storage explorer.

https://teststorageaccount21.blob.core.windows.net/publicc?sv=2019-12-12&st=2021-02-08T20%3A58%3A42Z&se=2021-03-09T20%3A58%3A00Z&sr=c&sp=rl&sig=AjF0IpWIBGZtBeKcOodd8HieENZ0F3Cuig54Y8e0oIM%3D

<Error>
<Code>AuthenticationFailed</Code>
<Message>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. RequestId:9cb791c8-a01e-0016-625f-fe693a000000 Time:2021-02-08T21:16:09.2176268Z</Message>
<AuthenticationErrorDetail>Signature did not match. String to sign used was rl 2021-02-08T20:58:42Z 2021-03-09T20:58:00Z /blob/teststorageaccount21/$root 2019-12-12 c </AuthenticationErrorDetail>
</Error>

When I try to access a blob within that container, I can access it without any problems.

This link can be used to see the file https://teststorageaccount21.blob.core.windows.net/publicc/MyTest1.csv?sv=2019-12-12&st=2021-02-08T21%3A20%3A53Z&se=2021-03-09T21%3A20%3A00Z&sr=b&sp=r&sig=%2Bw8oi73NUU4w%2FqgSAsNvjVHwBi0SgaoQAK6%2BF8P8QQs%3D

Why am I not able to see the list of blobs at the container level with public access. Also, I need help in understanding that authentication error. Not sure what signature didnt match.

1
@Frank Gong Sorry for accepting the answer so late, your answer helped much. So appreciate it.Sarah

1 Answers

1
votes

Your SAS token is blob level, you need to generate SAS token in container level:

enter image description here

If you list blobs by https://<storage-account-name>.blob.core.windows.net/<container>?<sas-token> in the browser, you will receive an error:

<Error>
<Code>ContainerNotFound</Code>
<Message>The specified container does not exist. RequestId:54174bad-401e-0046-218e-fe53dd000000 Time:2021-02-09T02:52:30.1104394Z</Message>
</Error>

So you need to use List Blobs API, please use this format URL:

https://<storage-account-name>.blob.core.windows.net/<container>?restype=container&comp=list&<sas-token>