In this series I’m showing you how to move your MySQL-powered WordPress blog to SQL Azure-powered backend. The first post”) talked about setting up the new platform, the second post”) was about moving your data and settings. This post will show you how to manage the infrastructure side of things: Microsoft Azure and DNS.
Step 1 – Move your custom domain name in Microsoft Azure
Now that I created my new blog I have two WordPress sites running on Microsoft Azure. Sorry for the “security by obscurity” in these screenshots by the way 🙂
What we want to do now is tell Microsoft Azure that traffic for my thomasvochten.com website now has to go to my new website. To do so, select your old website and click on the “Manage Domains” button underneath the page:
In the next screen, choose your domain and click the remove button:
Take a mental note of the IP Address mentioned at the bottom of the dialog box.
Before we add that domain back to your new site we must make some DNS modifications.
Step 2 - Verify domain ownership (again)
In order to add our custom domain to our new website we must be able to verify ownership to Azure again. Go to your DNS provider and add the following verification record to it:
- Type: CNAME
- Name: awverify.www
- Alias for: awverify.www.yourwebsitename.azurewebsites.net
- TTL: 1 hour
You might want to create another verification record without www too:
- Type: CNAME
- Name: awverify
- Alias for: awverify.yourwebsitename.azurewebsites.net
- TTL: 1 hour
If your site was already hosted at Microsoft Azure you could already have these records. In that case, just edit the aliases to point to the new website you created.
When you created this record wait a few minutes and go back to the Microsoft Azure management portal. Select your new website, click “Manage Domains” once again and add your custom domain:
In case you wonder: I’m using DNSimple for all my DNS management. It’s a brilliant site that focuses on just one thing: DNS. They offer great service and unrivaled DNS management capabilities. It costs me something each year but the benefits greatly outweigh the costs. If you subscribe via the link above, I get one month of DNS hosting for free BTW.
Step 3 – Making the switch, aka DNS
Both my old and my new website were hosted at Microsoft Azure. The beauty of this is that I don’t have to make any changes to DNS at all. The external IP address of both my sites is the same. If you’re using another hosting provider or did not get the same IP address from Azure, you have to change the A records for domain.com and www.domain.com to point to your new external IP address. In DNSimple that’s, well… simple!
Step 4 - Modify your site URLs in WordPress
Now is the time to tell your new WordPress site about your custom domain. Go to Settings, General to make this modification:
Your new site should now be reachable via your custom domain name again – be sure to test this! I disabled my old site to make sure I was arriving at the right place:
If you still arrive at the old site, you’ll get this one:
If everything went well, your new site is now up and running. After a few days, if everything runs fine, you can delete your old site from your Azure subscription and remove the accompanying ClearDB MySQL database.