Recently I decided to migrate this blog, yep this one, from it’s original WordPress multi-tenant host to a WordPress site on Azure Websites. It took a few attempts to get it right, here was the process.My site was previously hosted with a small independent host called CloudPWR ( These guys are awesome for consulting and moving businesses to cloud ). But because of my obsessive need to have everything together, and already having 5 sites hosted in Azure Websites I decided it was time to move this site over as well. My setup is as follows.
- All my domains and name servers are with Name.com ( love them plug #2 )
- All my applications, some services, and websites are on Azure
The problem I faced is I did not have root access to my old WordPress host, so the option of doing a manual move of the MySQL database then all the files was not an option. You might be wondering if my old host would not help me, they would, but I wanted to try it on my own. What I discovered is that this way was much cleaner, with fewer steps anyway. Step one was to setup my new staging website over on Azure. To do this I first need to create a database that WordPress will use. I really like the ClearDB service in the Azure Store for this. So far they have been very reliable, and I prefer to stick to an all PaaS and no VMs approach for my sites/apps.
When in Azure click on “Add-Ons” on the left menu in Azure near the bottom.
Click the “+ NEW” button at the bottom left of the page then click “Store”. Every-time I see “Preview” next to the store I get a moment of fear, but then I remind myself that I like to life dangerously with technology. So far no surprises.
Scroll to the middle of the list until you find “ClearDB MySQL Database”, and select it.
Next configure the settings for ClearDB.
This is a VERY step. First you must put your DB in the same region as your site. So whatever region you select here remember it for when you create your site. Second, for the migration to work with ClearDB you must also choose the Venus ($9.99) a month or higher plan. Most of you will have a site that exceeds the 20MB limit anyway, but if you don’t i’m sorry this is the only option because not only is there a 20MB limit on the DB size there is a MySQL hourly question limit ( number of queries ) of 3,600. You hit this limit fast because the migration tool makes a lot of queries in succession to the DB. If you choose the free one, when you use the migration tool you will hit this limit ( below error ), and you will be forced to delete the DB, and the site, and start all over. Trust me I know, I tested it for you :). You will get this error as well if you do a manual migration using something like MySQL Workbench. However in that case you can chunk the DB move over a few hours. Not fun. When you upgrade to the ClearDB Venus plan you will get 18,000 hourly question limit and in my case this was plenty to get the job done.
user error: User ‘rileybeebs’ has exceeded the ‘max_questions’ resource (current value: 3600)
Now that you have created the database, you can create your Azure Website. I’m starting with a free site for now, because I was not sure how long the migration was going to take me. Initially I setup a free Azure Website for hoarding.azurewebsites.net. Browse to the Websites section of Azure and click the “+ NEW” option. Select “From Gallery”.
Scroll to the bottom and find “WordPress”.
Enter your site name, select “use existing db” and the same region as your DB in my case “West”.
Select your newly created database, and you are done.
Backup and Move of Old Site
Now it’s time to create the backup of your old site. The plugin i’m using is WP Clone. It is very simple and free, however I suggest you donate like Idid. Install and Activate this plugin in your old WordPress site. Once you do you will get a new WP Clone icon at the bottom of the WordPress menu. Click this, and you will get the WP Clone page. Click Create Backup.
This will take about 5 mins, and for my blog the .Zip file that was generated was 168 MB in size. The size will vary based on your blog. Note that in Azure if you exceed a certain size you will have trouble with the migration and receive an error. You can fix this either by creating a custom PHP config on your site, or reducing the size of the backup, but using advanced settings and limiting some items to backup. When it completes the page will refresh. Click to copy the URL of the zip file stored.
Now visit your new Azure site URL which will look something like this hoarding.Azurewebsites.net. It will give you the WordPress installation wizard. You have to follow this simply wizard and create a password to get it. Whatever username and password you create here will be temporary and overwritten after migration, and you will end up logging in with your current hosted WordPress users.
All you need to do when you are automatically logged in after you create the user, is go to plugins, and “add new” install and Activate the “WP Clone” admin in your new WordPress instance. Just like you did for your old site. Visit the WP Clone page just as before, but this time paste the URL of the backup Zip, and Click “Restore from URL” This will take about 15 mins in my case.
You might get a little nervous when it finishes because no matter what you will get an error page saying something about page not found. The WordPress site still thinks it’s apart of your old domain. So from now until you remap your domain you will not be able to login to WordPress without some strange URL mapping problems.
But you will be able to visit the site. So check your root URL and make sure the look and feel of the site is there. You might also notice broken links, this is also because the default setting for your site is set to your old domain, not your temporary Azure url. It will make you a bit nervous for a while, but it’s all OK.
Now its time to change your DNS settings. Like I said I use Name.com for my domain and Name Servers. When you do an Azuresite the domain settings are a little funky. You first need to convert your azure website to Shared to get access to the manage domain feature. Do this by visiting your Azure site go to “Scale” top menu convert to “Shared” or higher.
Now the Manage domains button is available in your site settings at the bottom.
At your name server you will first need create two CNAME records for your domain one that points to awverify.wwww.[yourdomain].com to awverify.[azuresitename].azurewebsites.net and one for awverify.[yourdomain].com to awverify.[azuresitename].azurewebsites.net. I create both because I found in the past if I did not it would not let me add a root record without www, which you really should have for proper name resolution.
They do this step to verify you control the domain. When this is done you will be able to create an A record that points to the IP that Azure provides. This verification process has never been seamless for me. I’ve noticed that after I created the CNAME records I had to make sure I looked out of Azure and back in before it would do a check that pazsed. Weird… Waiting for the Name Server to update, and Azure to see the CNAME records was actually the most annoying part of the whole process.
After you add that magical A record you are done. The whole process was stressful, but it works very nice when said and done, and a lot easier than manually moving DBs and FTP files where there is a good chance all your plugins will break. And I know it worked well cause you all’s reading this post right now.