cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
nycnfc
Level: Powered On

Azure functions connecting flow to sharepoint with MFA

I am trying to use this tutorial: https://medium.com/plumsail/how-to-call-sharepoint-from-microsoft-flow-with-a-help-of-an-azure-funct... to set up custom MS Flow triggers using Azure Functions to do stuff with sharepoint docs. So, I followed the tut exactly and only changed my credentials so far. I get the following error telling me that the account is not authorized and I must first browse to the site and enable automatic login

 

 

2018-01-03T21:11:01.889 Exception while executing function: Functions.CreateFolder. Microsoft.Azure.WebJobs.Script: One or more errors occurred. Microsoft.SharePoint.Client.Runtime: Cannot contact web site 'https://mysite.sharepoint.com/' or the web site does not support SharePoint Online credentials. The response status code is 'Unauthorized'. The response headers are 'X-SharePointHealthScore=0, X-MSDAVEXT_Error=917656; Access+denied.+Before+opening+files+in+this+location%2c+you+must+first+browse+to+the+web+site+and+select+the+option+to+login+automatically., SPRequestGuid=9c003d9e-9090-5000-1519-82d69fd4d838, request-id=9c003d9e-9090-5000-1519-82d69fd4d838, MS-CV=nj0AnJCQAFAVGYLWn9TYOA.0, Strict-Transport-Security=max-age=31536000, X-FRAME-OPTIONS=SAMEORIGIN, SPRequestDuration=29, SPIisLatency=0, MicrosoftSharePointTeamServices=16.0.0.7206, X-Content-Type-Options=nosniff, X-MS-InvokeApp=1; RequireReadOnly, Content-Length=0, Content-Type=text/plain; charset=utf-8, Date=Wed, 03 Jan 2018 21:11:01 GMT, P3P=CP="ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI", Server=Microsoft-IIS/8.5, X-Powered-By=ASP.NET'.

Not really sure exactly what they mean there, but regardless my login requires mfa. Has anyone tried to do this before, is there something special I need to do when using mfa? Following is the few lines where client connection is made.

 

 

string userName = System.Environment.GetEnvironmentVariable("SharePointUser", EnvironmentVariableTarget.Process);

 string password = System.Environment.GetEnvironmentVariable("SharePointPassword", EnvironmentVariableTarget.Process); 

var authenticationManager = new PnPAuthenticationManager(); 

var clientContext = authenticationManager.GetSharePointOnlineAuthenticatedContextTenant(sharePointSiteUrl, userName, password); 

var pnpClientContext = PnPClientContext.ConvertFrom(clientContext);

 

Any help greatly appreciated.

 

edit: I've set up app registration in AD and tried using that password as an access token but that didnt work. Also tried giving the app registration extra permissions in AD -> App Registrations -> picked my app -> Required Permissions. Basically, looking for anyone who may have set up a flow with sharepoint and mfa .. or auth management with mfa in general. PLS HELP! Thanks.

2 REPLIES 2
Community Support Team
Community Support Team

Re: Azure functions connecting flow to sharepoint with MFA

Hi @nycnfc,

 

Please check this blog for more details about Azure functions:
https://flow.microsoft.com/en-us/blog/integrating-custom-api/

 

It seems that you have enabled MFA on your side, please disable it then try again to see if you will get the same issue.


Best regards,
Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
nycnfc
Level: Powered On

Re: Azure functions connecting flow to sharepoint with MFA

It would literally not be legal for me to disable mfa 

Helpful resources

Announcements
firstImage

Microsoft Flow Online Conference

Join us for a FULL day of FREE Microsoft Flow Sessions from some of the best minds in the industry!

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020

thirdimage

Flow Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

thirdImage

New Flow Community Board!

Check out the new Microsoft Flow Community Blog Topic Suggestion board!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Users Online
Currently online: 4 members 4,354 guests
Please welcome our newest community members: