3

I have a storage account in azure with ADLS gen2 (hierarchy enabled). I have created a app and a service principal. I have also created a container in the storage and a folder inside that container. Using ACL I have given execute permission to container and read and write permission to the folder.

I am able to copy data using azcopy to the directory I have created inside the container.

I would like to list the data I have copied. Since azcopy list does not work, I tried using rest api

Using Post req https://login.microsoftonline.com//oauth2/v2.0/token

client_id : app_id client_secret : secret grant_type : client_credentials scope : https://storage.azure.com/.default

I get a token. When I use this token here https:///?directory=&resource=filesystem&recursive=true

Authorization = Bearer x-ms-version : 2019-02-02

I get this error

{
    "error": {
        "code": "AuthorizationPermissionMismatch",
        "message": "This request is not authorized to perform this operation using this permission.\nRequestId:0cd2e016-601f-003b-5fbe-5870a7000000\nTime:2019-08-22T07:50:06.5848071Z"
    }

}

What am I missing here?

CHEEKATLAPRADEEP
  • 12,191
  • 1
  • 19
  • 42
Nipun
  • 4,119
  • 5
  • 47
  • 83
  • Have you assigned a RABC role to the service principal? For more details, please refer to https://learn.microsoft.com/en-us/azure/storage/blobs/data-lake-storage-access-control. –  Aug 22 '19 at 13:38
  • No I dont think so that is important as azcopy is working – Nipun Aug 23 '19 at 03:29
  • Is that you can use the service principal to login azcopy then you use azcopy to copy file to your storage account –  Aug 23 '19 at 05:06
  • I was looking at listing as azcoply list does not work – Nipun Aug 23 '19 at 09:36

1 Answers1

1

It requires **Read and Execute** permission to list the content of the directory.

I would suggest you to give Read & Execute both permission to application.

enter image description here

Reference:

https://github.com/MicrosoftDocs/azure-docs/blob/master/articles/storage/blobs/data-lake-storage-access-control.md

Please try and see if it works.

Mohit Verma
  • 5,140
  • 2
  • 12
  • 27