Azure Function exception could not load ActiveDirectory file or assembly

2

I am trying to write an azure timer function that writes files to Azure Datalake, but when I am adding the needed nuGet packages I am getting an error when I start the host

The error is as follows

[21/5/2018 8:36:20 AM] Executed 'NWPimFeederFromAws' (Failed, Id=03395101-41a5-44ef-96d8-f69c5d73eca7)
[21/5/2018 8:36:20 AM] System.Private.CoreLib: Exception while executing function: NWPimFeederFromAws. NWPimFeeder: Could not load file or assembly 'Microsoft.IdentityModel.Clients.ActiveDirectory, Version=3.19.5.13701, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not find or load a specific file. (Exception from HRESULT: 0x80131621). System.Private.CoreLib: Could not load file or assembly 'Microsoft.IdentityModel.Clients.ActiveDirectory, Version=3.19.5.13701, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

The using statements in my class looks as follows

using System;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
using Amazon;
using Amazon.S3;
using Amazon.S3.Model;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Azure.Management.DataLake.Store;
using Microsoft.IdentityModel.Clients.ActiveDirectory;
using Microsoft.Rest.Azure.Authentication;

I am unable to find why this is occurring, any pointers appreciated

Version of my host is as follows

Hosting environment: Production
Content root path: C:\Users\MattDouhan\source\repos\NWPimFeeder\NWPimFeeder\bin\Debug\netstandard2.0
Now listening on: http://localhost:7071
Application started. Press Ctrl+C to shut down.
[21/5/2018 8:36:17 AM] Reading host configuration file 'C:\Users\MattDouhan\source\repos\NWPimFeeder\NWPimFeeder\bin\Debug\netstandard2.0\host.json'
[21/5/2018 8:36:17 AM] Host configuration file read:
[21/5/2018 8:36:17 AM] {}
[21/5/2018 8:36:17 AM] Starting Host (HostId=desktop7cks1do-1525525221, InstanceId=8ef074ac-f031-4591-983d-d590041bd1c9, Version=2.0.11651.0, ProcessId=7060, AppDomainId=1, Debug=False, ConsecutiveErrors=0, StartupCount=1, FunctionsExtensionVersion=)
c#
azure
azure-functions
azure-data-lake
asked on Stack Overflow May 21, 2018 by Matt Douhan

1 Answer

4

It seems caused by library bug.

You could downgrade version of Microsoft.IdentityModel.Clients.ActiveDirectory to 3.14.0.

This is a similar issue, you could refer to it.

answered on Stack Overflow May 21, 2018 by Joy Wang

User contributions licensed under CC BY-SA 3.0