2017-04-05 103 views
1

我是Azure Data Lake Analytics的新手,正在將存儲過程提交到Azure Data Lake Analytics之前將C#批量作業轉換爲使用服務進行服務身份驗證。azure數據湖授權

public void AuthenticateADLUser()    
{ 
    //Connect to ADL 

    // Service principal/appplication authentication with client secret/key 
    SynchronizationContext.SetSynchronizationContext(new SynchronizationContext());   
    cTokenCreds = ApplicationTokenProvider.LoginSilentAsync(strDomain, strWebApp_clientId, strClientSecret).Result;   
    SetupClients(cTokenCreds, strSubscriptionID); 
} 



public static void SetupClients(ServiceClientCredentials tokenCreds, string subscriptionId) 
{ 
    _adlaClient = new DataLakeAnalyticsAccountManagementClient(tokenCreds); 
    _adlaClient.SubscriptionId = subscriptionId; 

    _adlaJobClient = new DataLakeAnalyticsJobManagementClient(tokenCreds); 

    _adlsFileSystemClient = new DataLakeStoreFileSystemManagementClient(tokenCreds); 
} 

即使我已經給它正確的客戶端Id錯誤回來了時,我執行下面的代碼錯誤不同的客戶端ID:

var jobInfo = _adlaJobClient.Job.Create(_adlsAccountName, jobId, parameters);. 

的錯誤信息是:

對象ID爲'e83bb777-f3af-4526-ae34-f5461a5fde1c'的客戶端'e83bb777-f3af-4526-ae34-f5461a5fde1c'沒有權限執行'超出範圍'/訂閱的Microsoft.Authorization/permissions/read'/a0fb08ca-a074-48 9C-bed0 -....

  1. 爲什麼ClientID的比我在代碼中使用的有什麼不同?
  2. 這是代碼問題還是權限問題?我假設它是代碼,因爲ClientID不是我創建的授權的代碼。

注意:SubscriptionId是正確的。

回答