我在Azure数据工厂中定制活动时遇到问题。 我想连接到它内的天蓝数据湖。 我使用下面的命名空间:Azure数据湖与数据工厂定制活动的连接
using Microsoft.Azure.Management.DataLake.Store;
using Microsoft.IdentityModel.Clients.ActiveDirectory
using Microsoft.Rest.Azure.Authentication;
这里是我的代码:
public ConnectDataLakeStore(string applicationId, string applicationSecretKey, string tenantId)
{
var credentials = new ClientCredential(applicationId, applicationSecretKey);
var creds = ApplicationTokenProvider.LoginSilentAsync(tenantId, credentials).Result;
var fileSystemClient = new DataLakeStoreFileSystemManagementClient(creds);
}
而且我得到以下异常:
Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Microsoft.Azure.Management.DataLake.Store.Models.AdlsErrorException: Operation returned an invalid status code 'Forbidden'
at Microsoft.Azure.Management.DataLake.Store.FileSystemOperations.<ListFileStatusWithHttpMessagesAsync>d__12.MoveNext()
当我运行在本地环境中的所有自定义活动工作正常。在部署到Azure之后发生问题。我还将所有可能的权限授予广告应用程序。
任何提示?
解决。 .NET Framework版本应该<= 4.5.2 – BRMaster