none
List all jobs information via SDK

    Question

  • I need to get all information for ADLA jobs via api, and following this tutorial currently. 

    https://azure.microsoft.com/en-us/documentation/articles/data-lake-analytics-get-started-net-sdk/

    Following code works for authentication of single user and lists all jobs.

    var authContext = new AuthenticationContext("https://login.microsoftonline.com/" + tenantId);
    var tokenAuthResult = authContext.AcquireToken("https://management.core.windows.net/", appClientId,appRedirectUri, PromptBehavior.Auto, UserIdentifier.AnyUser);
    var tokenCreds = new TokenCredentials(tokenAuthResult.AccessToken);

    This code for service-service also gets the token

    var clientSecret = GetSecureStringClientSecret();
    var authContext = new AuthenticationContext("https://login.microsoftonline.com/" + tenantId);
    var credential = new ClientCredential(appClientId, clientSecret);
    var tokenAuthResult = authContext.AcquireToken("https://management.core.windows.net/", credential);
    var tokenCreds = new TokenCredentials(tokenAuthResult.AccessToken);

    However when trying to list all jobs with call adlaJobClient.Job.List(_adlaAccountName); I get the following error

    An unhandled exception of type 'Microsoft.Rest.Azure.CloudException' occurred in mscorlib.dll
    
    Additional information: The client 'b6b9a244-d030-4667-bb3c-95b11ba147e4' 
    with object id 'b6b9a244-d030-4667-bb3c-95b11ba147e4'
    does not have authorization to perform action 'Microsoft.Authorization/permissions/read' 
    over scope '/subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroup}/providers/Microsoft.DataLakeAnalytics/accounts/{ADLAAccount}/providers/Microsoft.Authorization'.
    

    The AD app has all the rights and permissions however it is not created by AD admin. My objective is to get all jobs information for custom use case.

    How can i resolve this exception? and How can i get detailed job information like input/output with SDK?

    Tuesday, May 17, 2016 7:57 AM

Answers

  • Hi,

    Could you please double-check that the application has access to the ADLA account?

    • Open your ADLA account in the Azure Portal
    • Under the "Settings" section, click "Users".
    • Do you see your application listed? If not, please click the "+ Add" button to add the application. You'll be able to specify it by giving the application id "b6b9a244-d030-4667-bb3c-95b11ba147e4".

    Once your application has Reader (or better) access to the ADLA account you should no longer see this error.

    I hope this helps!

    Best regards,

    Matthew


    Tuesday, May 17, 2016 6:34 PM

All replies

  • Hi,

    Could you please double-check that the application has access to the ADLA account?

    • Open your ADLA account in the Azure Portal
    • Under the "Settings" section, click "Users".
    • Do you see your application listed? If not, please click the "+ Add" button to add the application. You'll be able to specify it by giving the application id "b6b9a244-d030-4667-bb3c-95b11ba147e4".

    Once your application has Reader (or better) access to the ADLA account you should no longer see this error.

    I hope this helps!

    Best regards,

    Matthew


    Tuesday, May 17, 2016 6:34 PM
  • Adding the application by name as  user worked smoothly for me.

    Regards

    Wednesday, May 18, 2016 6:55 AM