Error when try to download file from Azure Data Lake
Nanddeep Nasnodkar
1
Reputation point
I tried to download a file from Azure Data Lake. With the credentials, I can list the contents of the directory. But Downloading gives below error:
"This request is not authorized to perform this operation using this permission"
The code used:
TokenCredential credential = new ClientSecretCredential(
tenantID, clientID, clientSecret, new TokenCredentialOptions());
string dfsUri = "https://" + accountName + ".dfs.core.windows.net";
DataLakeServiceClient dataLakeServiceClient = new DataLakeServiceClient(new Uri(dfsUri), credential);
DataLakeFileSystemClient fileSystemClient = dataLakeServiceClient.GetFileSystemClient("DAIP_Data");
DataLakeDirectoryClient directoryClient =
fileSystemClient.GetDirectoryClient("DAIP/System2");
DataLakeFileClient fileClient =
directoryClient.GetFileClient("System2_iDoc_20211229182731_06e34fa6-f683-4568-8a5d-5ae30eac50b6.xml");
Response<FileDownloadInfo> downloadResponse = await fileClient.ReadAsync();
Any suggestion/ help would be appreciated.
Thanks.