pnp/PnP

Sharepoint authentication issue from Azure function (.net Core)

venkeykanle opened this issue · 1 comments

Hi Team,

At the outset apologies, if this is not the right group to address the issue.

Issue:
Unable to authenticate the Sharepoint url from Azure function, while its works good in my local environment.
Here is the code-snippet.:

using Microsoft.SharePoint;
using Microsoft.SharePoint.Client;
using SharePointPnP;
/*
....
*/
string siteUrl = "https://abcd.sharepoint.com/xyz/abcd123";
string clientId = "aaaaa-bbbbb-ccccc-ddddd-eeeeeeeee";
string clientSecret = "lalalalalalalalalalalalalalalalalalall=";

var clientContext = new OfficeDevPnP.Core.AuthenticationManager().GetAppOnlyAuthenticatedContext(siteUrl, clientId, clientSecret);

The last line throws error..
Works good in local (.Net frame work 4.x) and but fails to authenticate in Azure function (.Net Core 2)

Is there any alternative PnP in Azure function on .Net Code2.1?
Would be great if someone throw lights on correct Assemblies to be used or some solution.

Thanks,
Venkatesh Kanale

Hi I am also using same code and my targeted version is .Net Core 3.1 getting below error : The type initializer for 'OfficeDevPnP.Core.Utilities.TokenHelper' threw an exception.
---> System.TypeLoadException: Could not load type 'System.Web.Configuration.WebConfigurationManager' Please help me on this.