It seems like you have followed the correct steps to connect your Azure Web App to the Azure Database for MySQL flexible server. However, there could be a few reasons why the connection is not working.
Have you checked if the firewall rules are configured correctly? Check this by going to the Azure Database for MySQL flexible server and checking the firewall rules. Make sure that the IP address of the Azure Web App is added to the firewall rules.
Next item is have you checked if the connection string is correct? (You mentioned a lot about doing the ride things at the network layer but have you ensured you've added your connection string?) You can locate this by going to the Azure Web App and checking the connection string. Make sure that the connection string is pointing to the correct Azure Database for MySQL flexible server.
- Go to the Azure Portal and navigate to your Azure Web App.
- Click on the "Configuration" tab in the left-hand menu.
- Scroll down to the "Connection strings" section.
- You should see a list of connection strings. Look for the connection string that is used to connect to your Azure Database for MySQL flexible server.
- If you click on the connection string, you should be able to see the details of the connection string, including the server name, username, and password.
If the firewall rules and connection string are correct, then there could be an issue with the VNet peering. You can check this by going to the Azure Portal and checking the VNet peering between the two VNets. Make sure that the VNet peering is established correctly.
If you have checked all of the above, then there could be an issue with the Private DNS zone. Check this by going to the Private DNS zone and checking if the DNS records are correct. Make sure that the DNS records are pointing to the correct IP address of the Azure Database for MySQL flexible server.