Thanks for reaching here! If I have understood right you have deployed Azure Database for MySQL and wants to connect to flask app, If so then you can use below solution:
Solution 1 - Allow Azure services
Solution 2 - Create a firewall rule to explicitly allow outbound IPs
Let us know.