none
ADFv2 - Batch App - Reading File in ADLS - SPA - Cloud Exception

    Question

  • I am getting an error running a Batch App in Azure Data Factory version 2.  I am trying to read from a file in the Azure Data Lake Store using Service Principal Authentication.

    The error is:

    Microsoft.Rest.Azure.CloudException
      HResult=0x80131500
      Message=Exception of type 'Microsoft.Rest.Azure.CloudException' was thrown.
      Source=Microsoft.Azure.Management.DataLake.Store

                            dynamic adlsLinkedService = ((JArray)linkedServices).First(_ => "*****".Equals(((dynamic)_).name.ToString()));
                            
                            tenantId = adlsLinkedService.properties.typeProperties.tenant;
                            servicePrincipalId = adlsLinkedService.properties.typeProperties.servicePrincipalId;
                            servicePrincipalKey = adlsLinkedService.properties.typeProperties.servicePrincipalKey.value;
    
                            var credentials = new ClientCredential(servicePrincipalId, servicePrincipalKey);
                            var token = ApplicationTokenProvider.LoginSilentAsync(tenantId, credentials).Result;
                            adlsFileSystemClient = new DataLakeStoreFileSystemManagementClient(token);
                            //TODO - need to pass the account name 
                            accountName = "*****";
    
                            using (var input = new StreamReader(adlsFileSystemClient.FileSystem.Open(accountName, inputFileName)))

    The error occurs on the last line - I have inspected all input properties and they are correct.

    Friday, March 30, 2018 1:29 PM