I'm trying to create a Azure Function that references 'Microsoft.IdentityModel.Extensions'. I have a helper library dll, that includes code to provisioning a SharePoint Online site. This dll uses Microsoft.IdentityModel.Extensions. I have put this helper library in the bin folder and reference it from run.csx using the #r syntax, but I keep getting this error in the log:
Exception while executing function: Functions.ATPCreateSiteFunction. mscorlib: Exception has been thrown by the target of an invocation. ATP.SiteProvisioning.Cloud: Could not load file or assembly 'Microsoft.IdentityModel.Extensions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=69c3241e6f0468ca' or one of its dependencies. The system cannot find the file specified.
I have tried the following approaches to get Azure Functions to find the Microsoft.IdentityModel.Extensions assembly:
- Include the Microsoft.IdentityModel.Extensions.dll in the bin folder and reference in run.csx with this: #r "../bin/Microsoft.IdentityModel.Extensions.dll"
- Trying to include as Nuget package by referencing "Microsoft.Identity.Model.Extensions": "2.0.1459.0" in project.json (same Nuget used in the helper library itself)