The following steps show how to connect your existing web app on Azure App Service running on MySQL in-app or other MySQL solutions in Azure to Azure database for MySQL (Preview).
Before your begin
Log in to the Azure portal . Create a MySQL database on Azure database for MySQL (Preview) service . For details , refer to How to create MySQL database from Portal or How to create MySQL database using CLI.
Azure database for MySQL provides tighter security using Firewall to protect your data. When using this service with App Service Web Apps , you need to keep in mind that the outbound IPs are dynamic in nature .
- To make sure the availability of your web app is not compromised , we recommend to all the rule to allow ALL IPs as shown in the image below. Note: We are working with Azure database for MySQL (Preview) team for a long term solution to avoid allowing all IPs.
- You can explicitly add all the outbound IPs for your web app to MySQL server configuration . To learn more , see how to get outbound IPs for App Service.
Azure database for MySQL (Preview) has SSL Enabled . If your application is not using SSL to connect to the database , then you need to Disable SSL on MySQL server. For details on how to configure SSL , See using SSL with Azure database for MySQL (Preview).
Note that some applications frameworks may not support SSL , hence check your application framework documentation on whether to disable or enable SSL.
Migrating from MySQL in-app database to Azure database for MySQL (Preview)
You can migrate MySQL in-app database to Azure database for MySQL (Preview) using Export feature. Note in order to use this feature to export the database , you need to :
- Disable SSL since the feature does not work with MySQL database connected via SSL.
- Allow all IPs is configured on your MySQL server
App Service Back up and Restore features
Currently backup and restore feature does not work with SSL enabled for Azure database for MySQL (Preview). Disable SSL if you are planning to backup/restore the database using App service backup feature . Azure database for MySQL (Preview) also offers backup feature , for more details see here.