Moved the blog over to Windows Azure, here is how I did it.

Last night I moved the blog over from my personal hosting provider to Windows Azure. It turned out to be pretty smooth sailing. Here is how I did it.

First of all I am not the first one to do this, colleague (in the broad MS sense) Dave Borst has an extensive series of blog posts on how to do this which you can find here:

Part 1: Creating a WordPress Blog on Windows Azure

Part 2: Transferring Your Content

Part 3: Setting Up Your Custom Domain

Part 4: Pretty Permalinks and URL Rewrite rules

Part 5: Moving From a Subfolder to the Root

I followed step 1 to the teeth and it worked flawlessly and I setup my blog on http://kasperbi.azurewebsites.net/ as a free site (yes absolutely free !). I then proceeded with step 2 and successfully copied the files using FTP. Resist the urge to start playing with it, and most of all DO NOT register jetpack yet. Also don’t change the URL for the blog in the WP admin yet.

Next up was copying the content over from the MySQL database, this is where the trouble started Sad smile.  The technique used by Dave doesn’t work anymore because the plugins needed are pulled as of security concerns. So I had to find a different way. On my current provider I have access to PHPMyAdmin, I used that to create a SQL script that dumps content and structure for :

  • <name>_posts
  • <name>_postmeta
  • <name>_comments
  • <name>_commentmeta

Observe that the <name> part can be different for each wordpress installation, well get to that in a second.

All the other tables I didn’t want to touch, out of experience I know that touching wp_options can be very painful Smile.

In order for me to connect to the MySQL DB on Azure I downloaded the MySQL Workbench, I then used the MYSQL command to connect to the database. The connectionstring that can be used to connect to the database can be found on the Azure admin portal, on the dashboard you can click on the View connection strings. Now you can create the MySQL command:

mysql – u <USERNAME> – h <HOSTNAME> –p <DATABASENAME>

After providing the password I was connected. First I wanted to see what is in the database, I used the following command:

show tables;

This gives me a list of all tables in the database, it looks like the default name for wordpress on Azure is WP_. So I opened the SQL file that was created by PHPMyAdmin and used find and replace to make sure the table names correspond.  Next I removed the tables that we also have a dump of from the other wordpress installation:

Drop table wp_posts;

Drop table wp_postmeta;

Drop table wp_comments;

Drop table wp_commentmeta;

Don’t worry Smile the good thing about using Azure is that if you screw it up you can quickly delete the site and recreate it (I had to do it once).

Now I want to add the content to the new wordpress site, again using a MySQL command that will execute the SQL script that was generated:

mysql – u <USERNAME> – h <HOSTNAME> –p <DATABASENAME> < c:temptables.sql

This loaded the posts and comments successfully over to the Azure site. Next I configured the theming and plugins and the wordpress comment is working successfully.

Look at all the pretty bars:

image

Now for the part where I want to move over my domain names (kasperonbi.com and .com) to the Azure wordpress site, the Part 3: Setting Up Your Custom Domain blog post covers it in great detail and that just worked for me. If you want to use your own domain names you can’t use the free version so I changed my site from free to shared. Now the blog starts costing some money. I am using my MDSN benefits to cover for this (Reading Dave’s blog it is OK to use the MSDN benefits for your blog).

After switching to shared, I added the domain names and pointed my DNS records to the new IP adress and I was done:

 

image

I did not have to go through step 4 and 5 of Dave’s blog.

That’s it folks Smile Let me know if you have any issues with the blog

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.