0

I have ADLS Gen 2 SDK directory SAS generated and I am trying to use that SAS to list the directory content (get a list of all files in the directory). I reviewed the ADLS Gen 2 SDK python doc [enter link description here][1] but I was not able to find any example for how to create DataLakeDirectoryClient using a directory SAS token. Anyone has any idea on how to do that? I tried breaking down the SAS token into two parameter, "account_url" and "credential", and then create data lake service client as follow:

d = DataLakeServiceClient(account_url=account_url, credential=credentials)
file_system = d.get_file_system_client(path-to-container)
paths = file_system.get_paths(path=path-to-directory)

but that did not work since when I tried to iter through the paths I got the following error

*azure.core.exceptions.ClientAuthenticationError: Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
ErrorCode:AuthenticationFailed
authenticationerrordetail:Signature did not match. String to sign used was rl*

note: iter through the paths works only if I connect “storage account credentials”

  • Does this answer your question? [Azure Shared Access Signature - Signature did not match](https://stackoverflow.com/questions/25038429/azure-shared-access-signature-signature-did-not-match) – Ecstasy Aug 05 '22 at 09:24
  • [azure-storage-file-datalake - Authentication error getting access control.](https://github.com/Azure/azure-sdk-for-python/issues/9159) and [DataLake async file client cannot download using SAS tokens restricted to specific folders](https://github.com/Azure/azure-sdk-for-python/issues/23804) – Ecstasy Aug 05 '22 at 09:28

0 Answers0