Azure Data Lake Store访问失败:响应状态代码表示服务器错误:403(禁止)

时间:2017-04-18 00:47:12

标签: azure-data-lake

我正在尝试从data lake store下载文件,这是我使用的代码:

    _adlsAccountName = "myadls";
    _resourceGroupName = "NavigationResource";
    _location = "East US 2";
    _subId = "myid";
    string localFolderPath = @"E:\temp\"; 
    string localFilePath = Path.Combine(localFolderPath, "modGR_vrt.tsv");
    string remoteFolderPath = "/Rnds/";
    string remoteFilePath = Path.Combine(remoteFolderPath, "modGR_vrt.tsv");

    SynchronizationContext.SetSynchronizationContext(new SynchronizationContext());
    var domain = "microsoft.com"; // any value
    var clientId = "my client id"; // this is a native app
    var clientSecret = "clientSecret"; 
    var clientCredential = new ClientCredential(clientId, clientSecret);
    var creds = ApplicationTokenProvider.LoginSilentAsync(domain, clientCredential).Result;

    _adlsFileSystemClient = new DataLakeStoreFileSystemManagementClient(creds); 

    var result = _adlsFileSystemClient.FileSystem.GetFileStatus(_adlsAccountName, srcPath);

我收到此异常: 抛出异常:' Microsoft.Rest.TransientFaultHandling.HttpRequestWithStatusException'在mscorlib.dll中

附加信息:响应状态代码表示服务器错误:403(禁止)。

我已在Rnds文件夹及其所有文件上分配了我的应用读/写/执行权限。我错过了什么吗?

感谢。

1 个答案:

答案 0 :(得分:1)

除了Rnds文件夹和文件的权限之外,还需要对Rnds的所有祖先执行(X)权限。

请参阅此文档中的读取文件所需的权限

https://docs.microsoft.com/en-us/azure/data-lake-store/data-lake-store-access-control