1
votes

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:

  1. Include the Microsoft.IdentityModel.Extensions.dll in the bin folder and reference in run.csx with this: #r "../bin/Microsoft.IdentityModel.Extensions.dll"
  2. 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)
1
I can work around the issue, if I drop using the helper library and copy all the code into run.csx and insert all Nuget's from helper library in project.json. But this is not a very nice solution - I would really like to be able to have the SharePoint Site creation code separated info it's own library, and not have all code inline in run.csx.Thomas N. Sørensen

1 Answers

0
votes

I don't think you need to reference the file path to the DLL. Instead of #r "../bin/Microsoft.IdentityModel.Extensions.dll", try #r "Microsoft.IdentityModel.Extensions.dll".