Showing results for 
Search instead for 
Did you mean: 
Regular Visitor

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
Community Support

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.
Not applicable

Re: Error 502 - connecting to SQL Server over VPN

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



Helpful resources

Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.


Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,502)