Appreciate your suggestions.
My Requirement is, Read json file from ADLS using SSIS and load into SQL table
Implementation: I have implemented the code to read json file content in .Net Console app. This is working fine in Console app. I copied the same code in SSIS Script component, but it throws "The type initializer for 'Microsoft.Azure.DataLake.Store.AdlsClient' threw an exception" exception in AdlsClient.CreateClient.
using Microsoft.Rest;
using Microsoft.Rest.Azure.Authentication;
using Microsoft.Azure.Management.DataLake.Store;
using Microsoft.Azure.DataLake.Store;
using Microsoft.Azure.DataLake.Store.AclTools;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
JObject results = new JObject();
string applicationId = "<appid>;
string secretKey = <secretekey>;
string tenantId = <tenantid>;
string adlsAccountName = "<ADLSNAME>.azuredatalakestore.net";
ServiceClientCredentials creds = ApplicationTokenProvider.LoginSilentAsync(tenantId, applicationId, secretKey).Result;
AdlsClient adlsClient = AdlsClient.CreateClient(adlsAccountName, creds);
string srcPath = @"/InputFiles/1636274001230002_20180621_104427.json";
using (StreamReader readStream = new
StreamReader(adlsClient.GetReadStream(srcPath)))
{
var p2Object = JsonConvert.DeserializeObject(readStream.ReadToEnd());
results = JObject.Parse(p2Object.ToString());
}
date = ((string)results["eeData"][0]["startDate"]);
machine = ((string)results["eeData"][0]["machineName"]);
ppl = ((string)results["eeData"][0]["ppl"]);