Moving to WordPress with SQL Azure (Part 1)

A little over a year ago, I moved my blog to Microsoft Azure. Although I was very happy with the switch, there was still one thing that annoyed me big time: it was still powered by MySQL. That in itself is not much of a problem, but since my database has grown beyond the free quota provided by ClearDB, I finally had an incentive to move away from them. Why would I pay a monthly fee when I could get a much bigger SQL Azure database for free?

Step 1 - Creating a SQL Azure Database Server

Before you can start using SQL Azure, you have to create a database server. That sounds complicated, but it absolutely isn’t. Just browse to the Azure Management Portal, select “SQL Databases”, “Servers” and then “Create a SQL Database Server” - like this:

SQL Azure

Next, fill in the necessary details like your subscription and the login and password for the system administrator account. Write those down somewhere – we’re going to need that again in just a few minutes.

SQL Azure

After that you’ve got yourself a brand new SQL database server running in Azure!

SQL Azure

Now the cool thing about that is that you can connect to it with SQL Management Studio. This is how that looks - with not much to see for now because we did not create a database yet:

SQL Azure

Step 2 - Creating a new WordPress site by Brandoo

Even if you have an existing WordPress blog, the simplest way to move to SQL Azure is to create a new WordPress instance and move all your content & settings over afterwards. My blog is already running on Microsoft Azure, which makes the whole provisioning process a breeze. I’ve seen solutions that involved installing WebMatrix on your pc, creating a local WordPress site with a special abstraction plugin and then move that to your hoster via FTP. That works, but this one is much simpler! I’m not that much of a developer so not having to install any of those fancy tools is a plus for me.

Go to Microsoft Azure and choose to create a new website from the gallery. Go to the Blogs category and choose “Brandoo WordPress“:

Brandoo WordPress

That template already contains the necessary plumbing to abstract the database layer away from WordPress so it can talk to SQL Server. It asks you for a couple of parameters and you’re good to go. First, choose your website URL (we’re going to change that later on), choose to create a new dedicated database for your blog and give it a username and password:

Brandoo WordPress

Brandoo WordPress

Next, specify your already created database server to host this database on:

Brandoo WordPress

Click Finish and we now have a SQL Server, a database and a WordPress site!

New WordPress Site

When you refresh SQL Management Studio, you’ll see that your database and login has been created:

New WordPress Site

Finally, browse to your azurewebsites.net site to start the WordPress installation process:

New WordPress Site

Once that’s done you can login to your WordPress site and start updating to the latest version. In SQL Management studio you can now see that WordPress has created some tables for you:

SQL Azure

That’s it for now, your new WordPress blog runs on Azure Websites and SQL Azure! In the next post”) we’ll discuss how to move all your content to your new site, configure your plugins, maintain your existing URL’s and how to flip the switch to release your SQL Azure powered blog to the wild.