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

Error 502 - connecting to SQL Server over VPN

Hi all,

I'm attempting to connect a PowerApp to a SQL Sever. I'm on a VPN, and SSMS works fine on the same computer, but I get the below error when trying to connect. Is there anything different when trying to connect via PowerApps that I would need to change?

The server is clearly running, and I would imagine that being able to connect over VPN with SSMS would indicate that the server can accept remote connections. This isn't Flow related like a lot of the other 502 posts, and many of those don't seem to be "solved" so much as they just started working again.




  "error": {

    "code": 502,

    "source": "",

    "clientRequestId": "d16f049f-bc96-4d92-a8ff-7fad035754c5",

    "message": "BadGateway",

    "innerError": {

      "status": 502,

      "message": "Microsoft SQL: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - The wait operation timed out.)\r\nclientRequestId: d16f049f-bc96-4d92-a8ff-7fad035754c5",

      "source": ""



Community Support Team
Community Support Team

Re: Error 502 - connecting to SQL Server over VPN



Connecting to your on-premises data sources from PowerApps, you need to use on-premises data gateway. For more information, please refer to:




Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Level 10

Re: Error 502 - connecting to SQL Server over VPN

Hi @RMDNA are you still experiencing this error? Did the above reply help? 



Helpful resources


Power Apps Super User Class of 2020

Check it out!


New Badges

Check it out!


Power Apps Community User Group Member Badge

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


Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020


Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (5,204)