cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ericonline
Community Champion
Community Champion

Bad Gateway Azure SQL Stored Procedure

Getting a "Bad Gateway" error for a Flow. Aimed at Azure SQL, not on-prem. Where is the gateway?

Simple Flow:

- Push button

- Run Stored Procedure

- Will not run.

image.png

image.png

- I have the Azure SQL Server set to "Allow Azure services..."

image.png

Please advise.

Thank you

4 REPLIES 4
ericonline
Community Champion
Community Champion

Here is the error after the Flow times out. Do I need to grant special perms to my Flow connection? Its an Active Directory user but I'm admin on the DB.

{
  "error": {
    "code": 502,
    "source": "flow-apim-msmanaged-na-centralus-01.azure-apim.net",
    "clientRequestId": "redacted",
    "message": "BadGateway",
    "innerError": {
      "status": 502,
      "message": "Principal '@userNameParam' could not be found or this principal type is not supported.\r\nCannot add the principal ''@userNameParam'', because it does not exist or you do not have permission.\r\nclientRequestId: redacted",
      "error": {
        "message": "Principal '@userNameParam' could not be found or this principal type is not supported.\r\nCannot add the principal ''@userNameParam'', because it does not exist or you do not have permission."
      },
      "source": "sql-eus2.azconn-eus2.p.azurewebsites.net"
    }
  }
}

 

Hm... I can't figure out why this isn't working.

Just:

- Created a new role in the Azure SQL database

  - `CREATE ROLE powerappsAdmins`

- Granted execute permissions for the Stored Procedures to the new role

  - `GRANT EXECUTE ON dbo.sp_custom_addADUser TO powerappsAdmins;`

- Created a new SQL Connection in Flow

  - **NOTE:** Clicking "Add Connection" from the three dots does not allow a new AD Connection to be made. I had to click Data/Connections and add a new AD connection there.

Does the Stored Procedure action in Flow support AD USERS?

Hi,

 

Looking at this, this will require some deep in-depth troubleshooting. You are getting quite a few conflicting errors here. I would suggest to open a case with Microsoft Support. I'll include a link below; on how to reach out to them. If any other communities members may have run into this feel free to chime in.

 

If you would like to create a ticket with Microsoft Customer Support here is a link on how to do so: https://docs.microsoft.com/en-us/power-platform/admin/get-help-support

 

Regards,

 

Alex

 

-------

 

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

Sl_O
New Member

Hello,  if there is an error in the stored procedure it also could raise en error  as "BadGateway" . This confusing error mesage could misdirect you for finding gateway solution. Check to run your sp with same parameters in the pool or sql server query analyzer for the user that you made the connection in the logic app.

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (2,390)