Azure Logic App - 502 Bad Gateway Azure Database MySQL Flexible Server

Miguel Ángel Chuecos Piera 20 Reputation points
2024-05-16T06:25:55.0433333+00:00

I have created an Azure Logic App with public access (Inboud) and VNET integration in the outbound. This is the network config:

Screenshot 2024-05-16 at 08.07.07

On the other hand, in the Virtual Network linked to the Logic App, there is a private Azure Database MySQL Flexible Server. This is the network config:

Screenshot 2024-05-16 at 08.10.39

There is no Network Security Groups nor any service, rule or other security related service (Firewall, Route...).

Using the connectivity resolution tool from Logic App, the connection to Azure Database MySQL Flexible Server is successful:

User's image

However, from the Logic App designer, when connecting to the database cluster to perform a query (Azure Database for MySQL action) I get this error:

{
  "error": {
    "code": 502,
    "source": "0a7c12e12fd2b8d7.07.common.logic-westeurope.azure-apihub.net",
    "clientRequestId": "aa16c27c-e224-4aa1-8c4e-634d5ba51198",
    "message": "BadGateway",
    "innerError": {
      "status": 502,
      "message": "Unexpected Exception : System.Net.Sockets.SocketException (0x80004005): No such host is known\r\n at System.Net.Dns.HostResolutionEndHelper(IAsyncResult asyncResult)\r\n at System.Net.Dns.EndGetHostAddresses(IAsyncResult asyncResult)\r\n at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)\r\n inner exception: No such host is known\r\nclientRequestId: aa16c27c-e224-4aa1-8c4e-634d5ba51198",
      "error": {
        "message": "Unexpected Exception : System.Net.Sockets.SocketException (0x80004005): No such host is known\r\n at System.Net.Dns.HostResolutionEndHelper(IAsyncResult asyncResult)\r\n at System.Net.Dns.EndGetHostAddresses(IAsyncResult asyncResult)\r\n at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)\r\n inner exception: No such host is known"
      },
      "source": "azuremysql-we.azconn-we-003.p.azurewebsites.net"
    }
  }
}

Why do I get this error if there is connectivity?

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
2,908 questions
Azure Virtual Network
Azure Virtual Network
An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.
2,204 questions
Azure Database for MySQL
Azure Database for MySQL
An Azure managed MySQL database service for app development and deployment.
729 questions
{count} votes

Accepted answer
  1. Ben Gimblett 3,655 Reputation points Microsoft Employee
    2024-05-17T13:55:42.62+00:00

    Hi - if you're seeing this "code": 502, "source": "0a7c12e12fd2b8d7.07.common**.logic-westeurope.azure-apihub.net**", , "message": "BadGateway" Then it suggests you are using the managed-connector towards SQL

    As suggested by the source URL managed connectors are hosted in their own infra that cannot know of your VNET and network config

    basically the logic app calls out to the managed connector (http) - and by default the connector would require a public SQL endpoint to connect (TCP)

    The better choice here would be to use the built in or "in app" connector
    For more info on this please see here https://learn.microsoft.com/en-us/azure/connectors/connectors-create-api-sqlazure?tabs=consumption#connector-technical-reference

    Edit: See comments below - there's no built in connector for MYSQL but should be able to use OPDG (on prem data gateway with the managed connector to facilitate private comms)

    One easy way to tell - if you look for the connection , if it's "built in" it'll be under the "service provider" tab


0 additional answers

Sort by: Most helpful