Backing up Azure MySQL to Azure Storage
When you setup an Azure Database for MySQL server, it automatically handles backing itself up based on your specified Backup Retention Period in the Pricing Tier. You can even restore to a point in time. This is all well and good, but what if you just wanted to download the DB locally for development and testing? You could install a plugin on your website that handles backups. There are a multitude of WordPress plugins that do this. However, what if you aren't using WordPress or a system that handles plugins? There is still hope.
1. In the Azure Portal, go to your MySQL blade and hit the button in the top navigation to open up the Cloud Shell.
2. Select "Bash" if you've never used this tool before.
3. Type in df and hit return to list the folders. Find the one that has your clouddrive. In my case it is: /user/csuser/clouddrive. Also note the url of that drive because that'll be the container you use to get the exported file.
4. cd /user/csuser/clouddrive to move into that folder.
5. now you can run mysqldump to make the backup. Here's an example:
mysqldump -v -h yourmysqlinstance.mysql.database.azure.com -u [email protected] -p -B yourdbname > yourdbname.sql
That's it, now you just need to get your file.
6. Now go to your storage accounts and find the one that you noted from step 3 above.
7. You'll find your file in the File shares area of the Storage account.