How to backup a Web Site running on Microsoft Azure Web Sites

Keeping regular backups is important for anything on the web, nay technology, especially for mission critical applications, enterprise applications, or keeping your meme generator application from Build 2014 [not sure what I’m talking about? Watch the Day 2 Keynote].

In this example, I’m actually going to outline how I keep a backup of my blog, yes the one you’re currently reading right now. It is running on WordPress and represents a good portion of my journey into a career in technology, that means it’s countless hours of my time that I continuously have the opportunity to read what I’ve done in the past after doing a quick Bing search on something I’m currently working on.

Take a Backup of a Web Site.

In the Microsoft Azure Management Portal select the Web Site you wish to backup.

image

As you can see in the image below, I run my site in a Shared Web Site. This provides me with enough resources for people navigating my blog to get an excellent experience without it being too heavy on my pocket book.

image

The backup feature of Web Sites only works in Standard, so for now, I’m going scale my site to Standard. This is as simple as clicking on the Standard Button, then clicking on Save in the command bar at the bottom of the screen.

image

Once I click on the Save button, I am prompted to let me know that scaling to standard will increase my costs, but I’m not too worried as I’ll be scaling back down to shared again shortly.

image

After the scaling task finishes, I’ll be able to use the form in the Backups navigation to select my storage account I wish to have my backups save to, the frequency in which they are saved as well as a database which is linked to my Web Site as a Linked Resource in the previous tab.

image

So I’ll select my favourite storage account.

image

And include my ClearDB database which is linked to my site to be backed up as well.

image

Then I’m only one click away from knowing all my archived hard work is saved for me in my storage account.

image

After the backup is done, pay attention because this is important, I go back into the Scale tab and scale my site back down from Standard to Shared. This moves me back down into the lower billing range that I am comfortable running my site in.

What does Microsoft Azure Web Sites Backup?

In the image below you can see two files which identify a backup. The first which is an xml file describing the site that was backed up at a high level including the custom domain, web site service domain as well as the name of the database which was backed up. The second file is a zip file which contains a backup of your site which I will outline in more detail below.

image

Here is a quick snapshot of the contents of the zip file: a fs folder, a temp folder, a meta file and a file named the same as your database.

image

What is in the Azure Web Site Backup zip folder

FS – if you haven’t already guessed it, FS stands for File System. This retains a snapshot of the file system of your web site at the time the backup was taken. This includes both the site and logFiles folders so you have access to anything you would need.

Temp – My temp folder was unused.

Meta – This is an xml file which describes all aspects of your website including but no limited to Custom Domains, Configured SSL Certificates, App Settings, Connection Strings, Default Document settings, Handler Mappings (for custom FastCGI Handlers); Remote Debugging, Web Sockets. I could go on, but I believe you get the picture, if it’s something you set in the portal for your web site, it’s backed up in this file.

Database Name – In my case, I had a MySQL database selected, so this file is a MySQL dump file. This can be used to completely restore my database from schema to data.

Provisioning a MySQL Database from the Windows Azure Store

The Windows Azure Store is available as part of the Windows Azure Management Portal, a convenient resource for all of your Windows Azure needs, which can be accessed from a variety of Devices including your favorite iDevice, Surface, Windows Phone, Mac or PC.

At the time of writing, the Windows Azure Store is currently only available in the US.

Click on the + New in the Windows Azure Management Portal Taskbar, then select STORE.

CustomCMS-Store-TaskbarDrawer

The Store opens in a modal dialogue, either scroll down or filter to APP SERVICES to find ClearDB MySQL Database, then click the [next] arrow.

CustomCMS-Store-AppService-ClearDB

Select an appropriate database size (or stay with the Free plan and upgrade later once the site is live) and select the Subscription to charge. Provide a name for the Database (can be left with the default, a name will be assigned for automatically), select the region to provision the database in (whenever possible, try to provision the Web Site and database in the same region to avoid latency). Click the [next] arrow.

CustomCMS-Store-ClearDB-Create

The following screen will provide an overview of the monthly charges of the new MySQL Database. Be sure to review the terms of use and privacy statement, then click the [purchase] checkmark.

CustomCMS-Store-ClearDB-Purchase

After the Add-on has been provisioned, click on the Connection Info button in the Taskbar.

CustomCMS-Store-ClearDB-ConnectionInfo

Copy the connection string for use in your application. Alternatively, a newly created database can be added as a Linked Resource to an existing Windows Azure Web Site, the credentials will be surfaced under the connection string section of the CONFIGURE tab.

Brian Swan has an interesting solution for parsing a connection string from the connection string settings found in the CONFIGURE section of a Windows Azure Web Site in his blog entry getting database connection information in Windows Azure Web Sites

CustomCMS-Store-ClearDB-ConnectionInfo-Details

Stay Cloudy my Friends…

WebMatrix 2: Available at a Web Platform Installer Near You

WebMatrix v2  hits the shelves yesterday so run out and download it now!. There are many additions to WebMatrix in this launch and I would like to take the time to describe a few of the things that may shock and excite you.

If you aren’t familiar with WebMatrix here is a quick blurb from the product page:

WebMatrix is a free and lightweight web development tool.
Create, publish, and maintain your website with ease.

What is new in WebMatrix 2?

It’s incredible how many features they can plug into WebMatrix and still have it be very lightweight and simple to use. Let’s take a look at some of the newly supported features of WebMatrix 2.

Intelli-Sense & Syntax Highlighting

Ok, so this might not necessarily be *new* to WebMatrix, but it has definitely been expanded. Many of you may be asking, what the $#@! is Intelli-sense? Intelli-sense is autocomplete on steriods, not only does it list the options for what you are currently typing, but it provides information around if what you’re typing is a method, constant or other variable type, it will also provide you with the method signature or additional information about the particular item you have selected in the list. There is intelli-sense and syntax highlighting support for the following languages/frameworks:

  • HTML5
  • CSS3
  • Node.js
  • PHP
  • ASP.NET MVC
  • Javascript
    • WordPress
    • Joomla!
    • Drupal
    • LESS
    • SASS
    • jQuery Mobile

    Yeah, WordPress, Drupal and Joomla! support, WebMatrix is making it easier to extend your favourite Open Source CMS by providing a quick reference to the built in methods of these framework applications.

    Community Oriented

    Now for something everyone can enjoy!

    Web Gallery

    Install a wide variety of Open Source projects directly from the Web Gallery including WordPress, Joomla!, Drupal and phpBB. New items are added to this list on a regular basis, so it could also be a great tool to discover new Open Source Projects.

    WebMatrix-Community

    Extension Gallery

    Another cool community aspect of WebMatrix is the extension gallery, which allows you to build custom extensions to WebMatrix. The extension gallery is already chalked full of great extensions including Git for WebMatrix, iPhone, iPad & Windows Phone Simulator.

    Mobile Friendly

    Mobile is all the rage right now, so having a tool not only helps you test on mobile device emulators, but actually gets you started with Mobile Friendly Templates and has auto completion for jQuery mobile, it’s like a match made in heaven.

    Cloud Friendly

    Last but definitely not least, the one thing you most likely come to my blog for, THE CLOUD! WebMatrix allows you to deploy to Windows Azure right out of the box. Of course this isn’t the only deployment option, but quite frankly, it’s the only deployment option I’ll be using. Within a few steps you can be publishing an existing site from your hard drive to Windows Azure Web Sites, or pull down that WordPress site you installed using the Windows Azure Gallery for a few quick changes.

    To Learn more about the cloud features, read Announcing WebMatrix 2 by Jonathan Guerin.

    Update Released: Windows Azure Storage Plugin for WordPress

    Microsoft Open Technologies, Inc. announced today that they have released an update to the existing WordPress Plug-in, Windows Azure Storage for WordPress.

    If you aren’t familiar with the tool, essentially it allows you to sign up for Windows Azure, create a storage account and save your blog post assets like images, videos and documents in a durable, CDN enabled [enabling CDN in Windows Azure Storage] storage system with up to 100TB of storage!

    Why Update the WordPress Plug-in?

    The major reason for the update was to bring the tool inline with the most recent release of the Windows Azure SDK for PHP [Windows Azure SDK for PHP on GitHub]. For this reason alone, it is a great example of a real world application which reaches thousands of users [Current Downloads as of this post: 2635].

    Need Installation Instructions? Read Windows Azure Storage Plug-in for WordPress Updated by Brian Swan.
    Need a Blog? Sign up for a Free Windows Azure Account, then Setup a new WordPress Blog on Windows Azure Web Sites using the OSS Gallery.

    If you use WordPress as your blog engine or as a CMS, the Windows Azure Storage for WordPress Plug-in is definitely worth a look.

    How does the Plug-in Work?

    More interested in the Architecture of the Plugin? Read Windows Azure Storage Plug-in for WordPress by Doug Mahugh

    The plug-in uses the WordPress Filters to inject new storage functionality such as a tab for accessing existing items in the storage container, a mechanism for saving content to Windows Azure Storage, as well as providing XML-RPC support for saving attachments from third party blog tools (like Windows Live Writer).

    Under the covers the tool saves your media files as Block Blobs, it utilizes the BlobRestProxy exposed by the Windows Azure SDK for PHP to commit the files in individual blocks (max. 4mb in size) before committing the entire blob. The benefit to using this technique is if any one (or multiple) block doesn’t succeed in uploading, the maximum amount of data that needs to be resent to Blob Storage is reduced (which in turn saves in bandwidth usage).

    All thumbnails which are auto-generated by WordPress are uploaded in the same fashion, then the metadata (Container Name, Blob Name, Thumbnail urls) are all saved to the database using add_post_meta.

    Can I Contribute?

    If you want to add additional features, or view the Source code for the Windows Azure Storage for WordPress Plugin it is available from the WordPress Plug-ins SVN Repository under a New BSD License.

    More into Git? [Me too…] Instructions for Bidirectional operations between SVN and GIT

    Once you’ve downloaded the source, you may want to consider checking out WebMatrix which has support for PHP syntax highlighting and code completion, as well as WordPress specific code completion which will be helpful when you’re extending the plug-in.

    Happy Blogging!