How to migrate a WordPress blog to Windows Azure

Just recently I have migrated this WordPress blog to Windows Azure. I am actually writing this post on the new platform. I have learnt a few lessons along the way and it is always a good idea to document them while everything is still fresh in my head.

Like doing anything for the first time, I started by searching for How To articles on the web. One frustrating thing I found was that there were a lot of out of date info around and after following a few step by step guides to no success, I eventually gave up and decided to go on my own.

After failing a few attempts, I stopped following other people’s instructions and started thinking. What is the most important content I care about? The answer was obvious, the blog posts. Do I care about themes, plugins and comments, etc? Yes but they are not critical. At a bare minimum, I would be content if only the blog posts were migrated across. In that case, I just needed to backup and restore the WordPress database then. Once I realised what I needed to achieve, the migration path became much clearer. Well that was the initial thinking but nonetheless, the path was more or less clear. What I found later was that a straight backup and restore would not have worked as the new environment was not empty, there was already data in the database.

Now I will cut to the chase and describe what I did step by step.

1. Install plugin to work with WordPress’s MySQL database

The plugin I used was called Adminer (formerly phpMinAdmin). I simply went to Plugins -> Add New -> Searched for Adminer -> Install -> Activate.

2. Decide on tables on export

Goto Tools -> Adminer -> Start Adminer inside

Once in Adminer, I was presented with 11 tables, the trick was to work out which tables I needed to export.

I didn’t need to migrate this table because the new WordPress installation on Windows Azure contained all my options already and I could go back and match the settings manually anyway.

wp_users, wp_usermeta
Since this is my personal blog, I am the only user I care about, so no need to migrate this table either because I was already a user in the new environment. The ID of my users in both the old and the new databases were the same and this could be very handy during migrations.

wp_posts, wp_postmeta
These tables looked important, I definitely wanted to migrate them.

wp_terms, wp_term_relationships, wp_term_taxonomy
Yep, I also wanted to retain the categories.

wp_comments, wp_commentmeta
I decided not to bother with comments.

The table was empty (later found out it was deprecated).

3. Export

Clicked on Export from the panel on the left and selected the following options

Output: save
Format: SQL
Database: <BLANK>
Tables: <BLANK>

Before exporting, made sure I ticked wp_postmeta, wp_posts, wp_terms, wp_term_relationships and wp_term_taxonomy tables.

4. Edit the exported SQL file

Once I had exported the tables, I started to inspect the SQL file. There were links to the old site littered across the file. I simply did a search and replace. (For example, from to

5. Import into the new database

I then went into Adminer on the Windows Azure side and imported the SQL file. No errors. All good.

6. Check

Opened up the new site and it was a relief seeing all the old blog posts.

7. Publish a new blog post

If you are reading this, that means I have successfully migrated the blog from my old host to Azure. At least the main part.

8. What’s next?

There is still a bit of cleaning up to do as all those images and files from the old site also need to be moved to the new site. But that’s for another day. Stay tuned.