Following this MS Doc, but didn't get the expected result i.e., list of the containers in the storage accounts:
GET API: https://strprojuatuks001.blob.core.windows.net/?comp=list
Error is:
<?xml version="1.0" encoding="utf-8"?>
<Error>
<Code>ResourceNotFound</Code>
<Message>The specified resource does not exist.
RequestId:alphanumericid
Time:2024-04-20T05:51:35.1180726Z</Message>
</Error>
Few things:
Request to list containers in a storage account must be authorized. You would need to include Authorization
header in your request. To learn about various authorization schemes available, please see this link: https://learn.microsoft.com/en-us/rest/api/storageservices/authorize-requests-to-azure-storage.
Regarding the Authentication scheme Bearer is not supported in this version
error, the reason you are getting this is because you have not included x-ms-version
request header in your request. If this is not included in the request, then the REST API picks up the default service version which does not have support for bearer token authentication. To fix this error, you would need to include x-ms-version
header and set its value to a version that supports bearer token authentication. For example, x-ms-version: 2023-08-03
.
Regarding how to pass the sAS key/token as a header to the request
, simple answer is that you do not include SAS Token as a header to the request. A SAS token is always added to your request URL. If you are using a SAS token, your request URL would be something like https://strprojuatuks001.blob.core.windows.net/?comp=list&<your-sas-token>
. Also, since you are trying to list blob containers with a SAS token, please ensure that you have created an Account SAS Token
.