March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Below is the screenshot of my SQL connector in Power Apps. The same credential works fine in Power BI SQL connection, but it gives me following error in Power Apps. What's wrong with it and how to fix it? By the way, I have the free trial premium license of Power Apps. Thanks in advance.
{
"error": {
"code": 502,
"source": "msmanaged-na.azure-apim.net",
"clientRequestId": "e9c897af-a683-4a7c-b75c-6508e71ac881",
"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. (provide<truncated>
Session ID: fa2ce54e-4005-4c07-b1bc-3e3ea862d65a
Solved! Go to Solution.
Hi, @bergen288
You can install the local gateway standard mode (enterprise gateway) to use the same gateway in Power BI and Power Apps:
Manage an on-premises data gateway in Power Apps - Power Apps | Microsoft Learn
Best Regards
Jianpeng Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @bergen288
You can install the local gateway standard mode (enterprise gateway) to use the same gateway in Power BI and Power Apps:
Manage an on-premises data gateway in Power Apps - Power Apps | Microsoft Learn
Best Regards
Jianpeng Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
I asked wrong question because of wrong option. This time, I choose "Connect using on-premises data gateway" instead of "Connect directly". However, there is no gateway installed and if I click "install gateway", it brings me to microsoft Power Apps website: Microsoft Power Apps – Build Apps with AI | Microsoft. There is nothing about gateway installation. If I click "Sign in", then it brings me to my Power Apps home page. Because of no installed gateway, "Connect" icon is greyed out.
Actually, my company won't allow me to install any software on my laptop without approval while it is extremely hard to get something approved. There is a setup of SQL gateway for JWPKSQLEP02.corp.checkfree.com in my Power BI web service as shown below. My new question is how to connect to SQL in Power Apps with the SQL gateway in my Power BI web service?
Yes, it's privately hosted SQL database and not an Azure SQL database. With "The same credential works fine in Power BI SQL connection", I meant to use same credential to connect SQL table as screenshot below:
Thank you Expiscornovus
Hi, @bergen288
Make sure that the name/field/table is referenced correctly, if it is misreferenced it will trigger the issue:
Solved: bad gateway error 502 powerapps - Power Platform Community
Here's the Power Apps Connect to Azure SQL Server documentation, confirm that your steps are OK:
Connect to SQL Server from Power Apps - Power Apps | Microsoft Learn
Common issues and resolutions for Power Apps - Power Apps | Microsoft Learn
Best Regards
Jianpeng Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Jianpeng:
I will take a look of your links. Thanks.
HI, @bergen288
Thank you very much for your reply. Your description and screenshots, which really prove that there is no problem with your credentials. You'll need to check Power Apps' limits on the data source, as I provided earlier, to see if there are any statements that are causing a 502 error when sending a query.
This may be a correct way to solve the problem.
Power Automate throwing 502 BadGateway error. - Microsoft Community
Best Regards
Jianpeng Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @bergen288,
Just to double check. That address looks like it is a privately hosted database and not an Azure SQL database, correct?
As far as I understood the Connect Directly (Cloud services) option was for Azure SQL databases. But I might be wrong.
And when you say the Power BI SQL connection was working what do you exactly mean? Did you connect to the database from the Power BI desktop application on your local network?
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
125 | |
85 | |
69 | |
54 | |
45 |
User | Count |
---|---|
204 | |
105 | |
99 | |
64 | |
54 |