Migrating My WordPress Blog to SQL Azure

[This article was contributed by the SQL Azure team.]

This week I decided to take on an interesting challenge and see what commonly available applications I could get running on SQL Azure and the Windows Azure platform.  I remembered a while ago that WordPress had started making significant investments in partnering with Microsoft, and I was really pleased to run across https://wordpress.visitmix.com.  Historically running only on MySQL, WordPress now runs on SQL Server and SQL Azure, utilizing the PHP Driver for SQL Server!  The site has great how-to articles of how to install this on SQL Azure, and how to migrate existing WordPress blogs to your new deployment.

WordPress is one of the most prevalent content management and blog engines on the web, estimated to have nearly 1 million downloads per week used by up to 12% of all web sites.  Coincidentally, my personal blog ran on WordPress and thought this was a fantastic challenge to get it migrated over to SQL Azure and Windows Azure.

I chose to implement this utilizing the Windows Azure VM role.  With an on-premises Hyper-V server, I created a virtual image of Windows Server 2008 R2 with IIS and installed WordPress.  The install wizard automatically implemented database schema, making the database portion of setup very easy.  During the setup wizards, all I had to do was provide the location and credentials for my SQL Azure database running in the cloud.  Walkthroughs of how to accomplish that are here.

Once I customized the settings and theme, I then uploaded and deployed the virtual image to Windows Azure - making this a complete cloud deployment of both runtime and database.  Everything works without having to make any compromises to get this into the cloud. 

Take a moment to check it out.  The address is: https://blog.stevenyi.com.  Right now it features my outdoor passions for climbing and photography - I'll start posting on some additional topics there in the future, too.

The last step was properly managing DNS entries to reach my blog via my 'vanity' URL instead of using the *.cloudapp.net address you assign when deploying a service in Windows Azure.  Not being a DNS expert, this had me stumped for a little while.  Windows Azure provides friendly DNS entries to provide a consistent way to access your instances to provide an abstraction layer from Virtual IP addresses (VIPs) which may change if you decide to deploy an application from a different or multiple datacenters.

Fortunately, one of the great things about working at Microsoft is being able to reach out to some very bright people.  Steve Marx on the Windows Azure team authors a fantastic blog on development topics at https://blog.smarx.com that explains this in more detail and how to map custom domains to Windows Azure using CNAME records and domain forwarding.  The post is here.  I did mention that I wasn't a DNS expert - so after reading the post, he still needed to call me to basically repeat the same thing. 

If you have a moment, check it out and hope you enjoy the pics.  Have a great weekend.

-Steve Yi