Error when try to download file from Azure Data Lake

Nanddeep Nasnodkar 1 Reputation point
2022-07-18T04:58:15.493+00:00

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.

Azure Data Lake Storage
Azure Data Lake Storage
An Azure service that provides an enterprise-wide hyper-scale repository for big data analytic workloads and is integrated with Azure Blob Storage.
1,426 questions
{count} votes