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

502 bad gateway connecting Flow to SharePoint 2016 on premise

Hello,

I am trying use Flow on our SharePoint 2016 on premise instance. So I built  an On premise data gateway, this part is rather simple and well explained even behind a proxy. I have left the default https connection enabled. So the connection report is fine and I was able to create a connection in Flow > Gateways.

 

But when I test a simple trigger like when files added in SharePoint I receive and 502 error :

{
"error": {
"code": 502,
"source": "europe-002.azure-apim.net",
"clientRequestId": "b36ccb60-23fd-4ba9-b831-dbb96209c739",
"message": "BadGateway",
"innerError": {
"message": "Received error payload from gateway service with ID 33707: Substituted: HttpRequestException:<pi>System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. ---> System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.\r\n at System.Net.TlsStream.EndWrite(IAsyncResult asyncResult)\r\n at System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar)\r\n --- End of inner exception stack trace ---

 

It looks like flow Flow tries to connect to the SharePoint site without success. It can be simple connection error or and an SSL error. It all depends on how Flow make resolves the name and makes the http call. Is it through the gateway or internet ?

Our SharePoint is not accessible from outside our LAN, so do we have to just add a dns record or go further with azure application proxy ?

 

Thanks for any suggestion ,

Jean Marie

3 REPLIES 3
Community Support Team
Community Support Team

Re: 502 bad gateway connecting Flow to SharePoint 2016 on premise

Hi @JM_THIA,

 

How did you create a connection to SharePoint On-premises?

Please make sure you followed the steps suggested in the following blog:

https://powerapps.microsoft.com/en-us/blog/support-for-sharepoint-on-premises/

Further, if the Site address is not listed under the dropdown selections, please enter the correct site address manually by clicking the Enter custom value. Please take a try with it.

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

JM_THIA
Level: Powered On

Re: 502 bad gateway connecting Flow to SharePoint 2016 on premise

HI @v-litu-msft ,

 

I did follow the mentioned link to create the connection and also manually add the site address and folder. Of course I have selected my on prem connection in the option of the stage.

 

2019-10-30_11h11_30.png

yesterday after a while and adding a / at the end of the url, the error message went away. It is not the case today where the error says We cannot find the site address.

So back to my question : how do Flow resolve the name of my SharePoint site ? It seems that it uses a simple DNS search.

If it is the case, then does Flow needs to authenticate to the site using a standard http connection instead of the gateway ?

Regards

Community Support Team
Community Support Team

Re: 502 bad gateway connecting Flow to SharePoint 2016 on premise

Hi @JM_THIA,

 

Ok, you can have a try to use the Send an http request to SharePoint action get files in SharePoint:

You can refer to this blog, it collect some methods how to call SharePoint in MS Flow, hope some will help:

https://veenstra.me.uk/2018/08/28/sharepoint-microsoft-flow-user-guide-to-using-the-sharepoint-rest-...

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

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 Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (4,914)