Unable to connect to Azure Database for MySQL flexible server

PeterT94 0 Reputation points
2023-11-15T17:29:02.15+00:00

Hello,

I configured a Private Connection between an existing Azure App Service and a newly created Azure Database for MySQL flexible server. However, I cannot connect to my Azure Database for MySQL flexible server (through MySQL Workbench). I am receiving "Failed to connect to .... " "Unable to connect to localhost".

The way I configured the Private Connection is:

  1. In my existing VNet, I created 2 new subnets:
    • PrivateLinkSubnet (192.168.103.0/24)
      • AppSvcSubnet (192.168.102.0/24)
  2. In my Azure Database for MySQL Flexible Server, I created a private endpoint and linked this to the Azure Database for MySQL Flexible Server. I assigned it to the subnet PrivateLinkSubnet (192.168.103.0./24) that I created above.
    In the DNS option, I selected "Integrate with Private DNS zone: Yes". I placed this in the same resource group as the App Service and Azure Database for MySQL Flexible Server.

I unticked the box "Allow public access to this resource through the internet using a public IP address"

  1. Finally, in the existing App Service, I configured the VNet integration to use the subnet AppSvcSubnet (192.168.102.0/24) that I created above.

Does anyone know what I am doing wrong?

Thank you in advance.

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,407 questions
{count} votes

1 answer

Sort by: Most helpful
  1. SnehaAgrawal-MSFT 20,856 Reputation points
    2023-11-17T10:44:43.8766667+00:00

    @PeterT94 Thanks for reaching here! If you want to connect an App Services Web app to an Azure Database for MySQL - Flexible Server in a virtual network you need to follow below steps.

    • Create a virtual network and a subnet for the web app and the database server.
    • Create an Azure Database for MySQL - Flexible Server instance and configure it to use the subnet.
    • Create an App Services Web app and configure it to use the subnet and the regional VNet integration feature.
    • Update the web app's connection string to point to the database server's hostname and credentials.
    • Test the connection from the web app to the database server using tools like MySQL Workbench or Azure Data Studio.

    For more details suggest you refer this detailed article- Tutorial: Connect an App Services Web app to an Azure Database for MySQL - Flexible Server in a virtual network

    Hope this helps, Let us know if further query or issue remains.

    0 comments No comments