cannot access to URI SAS blob storage AuthenticationFailed

M Do 1 Reputation point
2022-08-25T15:44:58.293+00:00

hi,

im trying to access to a specific blob by URI SAS but i got error AuthenticationErrorDetail, is there anything im doing wrong here?

Thank you for your help!

url = f"https://{account_name}.blob.core.windows.net/{container_name}/{blob_name}"

sas_token = generate_blob_sas(
account_name=account_name,
container_name=container_name,
blob_name=blob_name,
account_key=account_key,
permission=AccountSasPermissions(read=True),
expiry=datetime.utcnow() + timedelta(hours=6)
)

url_with_sas = f"{url}?{sas_token}"

<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:bcf014e5-401e-0181-6499-b8d2d4000000 Time:2022-08-25T15:42:09.0324529Z</Message>
<AuthenticationErrorDetail>Signature did not match. String to sign used was r 2022-08-25T21:41:59Z /blob/devstoreaccount1/basiccompanieshouse/node/node_basic_company_data_20220605.csv 2020-06-12 b </AuthenticationErrorDetail>
</Error>

235157-image.png

Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,427 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Sumarigo-MSFT 43,641 Reputation points Microsoft Employee
    2022-08-25T16:32:03.997+00:00

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

    It looks like you are trying to load a container via the URL in your browser. Unfortunately this is not supported by default. If you try loading a specific blob then it should work as you are intending. If you want to list all blobs in the container you need to use the List Blobs format.

    SAS Token has been generated for complete container ``234974-image.png

    If you generate a SAS token inside the contain for specify file it will work .
    234900-image.png

    For more information on SAS token, please refer to the Best practices

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

    ----------

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

    1 person found this answer helpful.