0

I generated a sas token with the list permission for a folder in a datalake storage account gen2.
Howerver when I try to access it with an httpGet request, I get AuthorizationPermissionMismatch error This request is not authorized to perform this operation using this permission
I know that to list a container with httpRequest we have to add &comp=list&restype=container in the queryString. Is there any specific param to add for listing a folder
Thanks

Reeza
  • 20,510
  • 4
  • 21
  • 38
AnotherGeek
  • 874
  • 1
  • 6
  • 24
  • Please edit your question and include your request URL. Do obfuscate the account name and sig portion of the SAS before sharing. – Gaurav Mantri Jan 19 '22 at 15:04
  • The url that I use is the one generated by azure when creating the sas token – AnotherGeek Jan 19 '22 at 15:06
  • Can you please share that? – Gaurav Mantri Jan 19 '22 at 15:08
  • https://datalake01.blob.core.windows.net/container01/api-access?sp=l&st=2022-01-19T14:26:48Z&se=2022-01-21T22:26:48Z&spr=https&sv=2020-08-04&sr=d&sig=rlae7Vxq1D3rVIW%2FovAK4Trp7UJFqidAF0aW7rIHf88%3D&sdd=1 – AnotherGeek Jan 19 '22 at 15:23
  • Does this answer your question? [I am facing issues for Get Container ACL and Set Container ACL REST API using postman using AAD Token as authentication](https://stackoverflow.com/questions/69884958/i-am-facing-issues-for-get-container-acl-and-set-container-acl-rest-api-using-po) – Ansuman Bal Jan 19 '22 at 15:42
  • No I am not using AD authentication, I am trying to use sas to aceess a folder with an httpget request. It works on container level but not in folder level – AnotherGeek Jan 20 '22 at 14:01

1 Answers1

1

Once you have generated the SAS token on the container level using the required permissions. You can add a directory filter in the rest API like below :

https://<StorageURL>/<Container>?directory=<DirectoryName>&restype=container&comp=list&<SASToken>

I tested the same in my environment . I created ADLS Gen 2 Storage account , a test container and then a directory named as Folder and added few files in it as shown below :

enter image description here

Then using SAS generated on container level , I called the below Rest API :

https://adlsgen2ansuman.blob.core.windows.net/test?directory=folder&restype=container&comp=list&sp=racwdlmeop&st=2022-02-03T06:55:43Z&se=2022-02-03T14:55:43Z&spr=https&sv=2020-08-04&sr=c&sig=xxxxxxxxxxxxxxxxxx

Output:

enter image description here

Ansuman Bal
  • 9,705
  • 2
  • 10
  • 27