An Azure service that provides private connectivity from a virtual network to Azure platform as a service, customer-owned, or Microsoft partner services.
Hello @Pavol Karkas,
Welcome to Microsoft Q&A Platform. Thank you for reaching out & hope you are doing well.
I understand your question about the Azure App Service failing to establish a TCP connection to the Azure Database for MySQL Flexible Server over an existing approved Private Endpoint connection, where the application consistently throws a Connection timed out (mysqli_sql_exception) error.
It looks like the problem is with the private connection setup rather than your database or login details, since you can connect over the public internet just fine.
Sometimes after restarting your app and database, the private network settings or DNS (which helps your app find the database) can get mixed up. To fix this, please check these things:
- From your app service, run a DNS lookup for your database's name. It should point to the private IP address. If it points to the public IP, then the private DNS settings might need to be reconnected.
- Make sure the private DNS zone (privatelink.mysql.database.azure.com) is properly linked to the virtual network your app uses.
- Confirm your app is still connected to the right virtual network and subnet.
- Check in the Azure portal that the private endpoint is still showing as Approved and Connected.
- Verify your app is connecting using the full database name (like yourserver.mysql.database.azure.com) rather than a direct IP address.
Looks like turning off secure transport only helped on the public connection, so SSL isn’t the reason for the timeout. The real issue seems to be that your app’s traffic isn’t making it to the database over the private link.
Next, please check the DNS lookup first. If it shows the public IP, try relinking the private DNS zone to your network. If it shows the private IP but still times out, double-check the private endpoint status.
Reference:
https://learn.microsoft.com/en-us/azure/mysql/flexible-server/how-to-troubleshoot-common-connection-issues
https://learn.microsoft.com/en-us/azure/mysql/flexible-server/concepts-networking-private-link
Kindly let us know if the above helps or you need further assistance on this issue.
Please "Accept the Answer" if the information helped you. This will help us and others in the community as well.