Azure Web Apps Backup-Restore

As you can probably tell, this blog is running on WordPress. And if you know me just a little bit you’d probably guess it’s hosted on Azure Web Apps. I love Azure Web Apps. One of the features which I have probably under-appreciated but really appreciate now is the Backup and Restore feature. I had forgotten how much I loved it until just today when it came in super handy doing something that anyone who runs WordPress has to do frequently, run updates.

Are Backups for Wimps?

If you run a WordPress blog you probably read (or hopefully you are reading) lots of stories about a rash ofWPUpdatesAvailable recent WordPress vulnerabilities across WordPress Core and a number of very popular plug-ins. If you care about these vulnerabilities, and I hope you do, you’ve probably updated WordPress Core and some plug-ins in the last few weeks. That’s what I did today and its where the under-appreciated Backup-Restore feature for Azure Web Apps earned my renewed appreciation, and this blog post to show it.

So today I opened my blog and went to the Dashboard and I see this image above. (You can click on this to see a larger version). I have to update WordPress Core and some plug-ins and a theme too. Did you notice at the top where it says, “please back upBackupsAreForWimps your files and database”? How many times did you say, what ever. It will work. Heck, even Chuck Norris says, “Backups are for Wimps”. Who am I to argue with Walker, Texas Ranger.

So from the Dashboard I ran the update on WordPress Core. That update worked fine. Next, I updated my plug-ins, again no problem. Chuck Norris is so wise. Much more wise than that Claude Van Damme guy. I don’t need to run Backup!

Finally I ran the update on my theme. I have a child theme on top of the WordPress Twenty Eleven theme. This allows me to update the parent theme without impacting my theme over-rides. Twenty Eleven gets updated a lot but I’ve never had any problems updating it. Unfortunately today this was not the case. When I ran the update something went horribly wrong and as you can see here, it did not update properly. In fact, it completely killed my site.

WPThemeUpdateFailed

Well, Mr. Walker, Texas Ranger, I’m here to tell you that Backups are not for Wimps. WordPress updates can and DO fail and sometimes they fail hard! And making backups, even if its for something trivial as a blog, is worth it.

Enter Azure Web Apps Backup-Restore

A couple years ago after my original blog blew up taking four years of blog posts with it, I decided that when I created my new blog I would put it on a daily backup schedule and allow Azure Web Apps to dutifully back up all my blog’s files AND DATABASE each day. Setting this up for my site is very easy and I’ll show you how easy it is. Note that you need to be running on the Standard Tier to perform the following steps.

First, open the Azure Management Portal and navigate to the Storage tab. From there create a new Storage Account. Give it a name that is easy to associate with your web app. Allow it to provision.

Next navigate to your app in the Web Apps AzureWebAppsBackupConfigtab. Click on your web app from the list and then click on the Backups tab. From there turn on Automated Backup and select the Storage account you provisioned, set the frequency and time to run your backup. Pick a time of day when there is very little load on your app.

Finally, click the drop down for databases and select whatever is there. THAT’S IT. Just set it and forget it. BTW, if your database is > 10GB and on Azure SQL DB you need to backup your database using the Azure SQL Database Backup. If you are using MySQL from ClearDB you need to use their Backup feature which will cost you a little bit of money.

Running a Restore

This is a feature that I had only ever run once before; when I first set it up. I wanted to make sure it worked. As you know and I’m sure your mother has told you. A disaster recovery plan that has never been tested is the same as not having a disaster recovery plan at all. As you might expect doing a restore is super simple and they run very quickly. My site restores in less than a minute, albeit my database is only 4MB in BackupRestoreOnesize. If your database is larger it will take longer to restore.

To restore a site in Azure Web Apps just go back to the Backup tab in the Azure Management Portal for your web app, then click “Restore Now” at the bottom of the screen.

Next, select from the list of backups that have been created. Select the backup you want, generally this is BackupRestoreTwogoing to be the last backup. Then click the arrow at the bottom right.

In the next screen select the Current web app to restore the backup into and make sure to select the databases too. Then click the check mark at the bottom right. That’s it. In a few minutes your site will be back to the state it was in at the last backup.

Conclusion

So that’s the Azure Web Apps Backup-Restore feature. It’s easy to setup, easy to use (because you can schedule it to run with no user interaction) and restoring your site is easy too. If your site is running on a Standard Instance you get 2 backups per day and up to 50 per day if you are running on a Premium Instance. I don’t know what you would do with 50 daily backups but there it is if you want it.

As handy as this feature is, there are a few capabilities I wish it had. For instance there is no way to set a retention policy. If you have a large site with lots of images (which you should keep in Blob Storage anyway) and/or a database that’s big in size, over the course of a year you’ll have a surprisingly large amount of storage being consumed from backups sitting in your Storage account.

The other capability I wish this feature had is the ability to restore this into an existing provisioned web app or even better, into an isolated site slot with an isolated database. Currently, you can restore your site into a new instance and also into a new database and the Restore can also automatically update your connection strings so your restored site can access the restored database in a new location. If this was simpler and more turnkey where I can restore into a new site and database and then just hit Swap that would be very cool. However, knowing the team that builds and runs Azure Web Apps, I’m betting they’ve thought about this and would not be surprised to see this or something like it in the near future, especially now with the emergence of the Premium SKU’s that are targeted at very high-end enterprise scenarios.

FacebooktwittermailFacebooktwittermail

2 thoughts on “Azure Web Apps Backup-Restore

  1. Mark, Thanks for posting this guidance. You don’t specifically mention the WordPress MySQL database (managed as a separate resource). Is this definitely included in the Web App’s backup?

Leave a Reply

Your email address will not be published. Required fields are marked *