Microsoft Azure makes it very easy to create WordPress Web sites, as with basically few clicks you will be able to create and configure your new Web site and make it up and running in the Microsoft Cloud. However, if you have an already existing site running somewhere else (other providers or may be on-premise) and want to migrate it to Azure, you will have to follow some additional steps to move your full site to its new home. This is what we will see in this post.
Before making this blog online, I had a locally installed WordPress site that I was using to write my notes and articles that I was keeping for my own reference. In fact, I used to use Microsoft Office OneNote & OneNote Online, which in my opinion are great tools, then I moved to WordPress and started writing all my notes there, as I wanted to master all the facets of this CMS.
After sometime, I decided to publish my notes as I was pretty sure it could at least help some few people who would be interested in the same technologies as me. After doing some search and proceeding with some tests, I was able to do a clean migration of WordPress site locally installed on my laptop to Azure Web Sites with only few clicks, thanks to great WordPress plugin called WP Clone. This is free of charge plugin allows you a painless move of your WordPress site to another domain or hosting server.
In my case, I have a locally installed WordPress site called vadmin-land.com installed on my laptop and I am using my local machine hosts file that I have modified accordingly to be able to access my site locally. The domain name being mapped to 127.0.0.1 in my hosts file. MySQL database and Apache Web server are running on WAMP server.
This post will explain the procedure to migrate your site from your on-premise infrastructure or any other hosting provider to Microsoft Azure.
Step 1. Installing the WP Plugin and Backing up your WordPress Site
From your WordPress site dashboard, install the WP Plugin and activate it
Once activated, you will have a new option in the plugin section to backup your Web site. Click on create a backup.
The plugin will then proceed with the backup and after completion, it will provide the URL from where you can restore it from the destination Web site. In this case from Azure.
Step 2. Creating the Azure WordPress Web Site
Login to Azure Web Portal and from the Dashboard click Create resources
The Azure Marketplace is displayed. Select the Everything section and in the filter space, type wordpress. This will display the WordPress variants than can be created in Microsoft Azure. As we will create a one-tier simple Web site, we will choose WordPress from the list.
Click on the Create button on the right of the screen
Provide the required information. I am creating a new Resource Group and choosing MySql In App for this Web site. I am also creating a new service plan that will be located in West India.
- A Resource Group in Azure a logical group of assets that provide an easy way of automatic provisioning, monitoring, and access control of the resources it contains.
- In Azure, MySQL In App makes it possible to run MySql natively on an Azure App Service platform. MySQL server will be running on the same instance side by side with your web server hosting the site.This will boost the performance of your Web app but the Auto Scale feature is not supported since MySQL is runnin on on a single instance.
- An Azure App Service Plane is a set of compute resources for a web app to run in a specific region. While creating an App Service Plan in a certain region, all the set of resources created in the same plan will also run in that region
I am placing my App Service Plan in West India.
As the Web site is still in testing phase, I will choose the Free Tier for now
Once done, click on OK
Review your selection and proceed to your WordPress site creation
Once the resource is created, you will prompted to review it. Click on Go to resource to check the Web site propeties
From the Web app resource Overview Pane, you will be provided with your Web site URL. You can view your Wep App status and also stop or restart if maintenance is needed to be done. Dont’ hesitate to explore the different options available in the dashboard as you will find some predefined set of various optimization techniques and some handy plug-in that will help you maximize the performance of your WordPress site.
You now have a fresh installation of your WordPress site running on Azure. Go ahead with the inial configuration step and Install the site.
Once your WordPress site installation is done, the first thing to do is to install the WP Clone plugin as we did in the first step, as we will need it to restore the original Web site.
Step 3. Moving your WordPress Site to Azure
We will now restore the backup that was already created in the first into our Azure Web site. Usually, the procedure is very easy as we just need to use the URL provided while creating the backup and paste it during the restore step. However, because the original Web site is locally installed in my machine, Azure will not be able to resolve the URL provided.
As a workaround, I will move the backup file which is in zip format to the wp-content of my Azure Web site, then run the restore to use this file, thus, making the URL resolvable by Azure. For I will use FileZilla to copy the file to my Azure ftp space linked to my Web app.
To have get the FTP host name and username to be used to connect to the ftp server, go on the Resource Group then go to the Properties pane.
Use FileZilla or any other FTP client tool to connect to your FTP server and copy your backup file to your Azure Web root path.
Once the copy is finished, you may good to go to restore your site from that path. I have copied the bakup file /site/wwwroot/wp-content, so the restore path will be https://WebSiteName.azurewebsites.net/wp-content/NameOfYourBackupFile.zip
The restore will take sometime, depending on the size of your Web site. Once done you might have a look and reconfigure your permalinks to avoid having any dead link.
Congratulations! Your Web site is now publicly available on Azure Cloud.
The last thing to do is to point your site CNAME to point to YourWebSiteName.azurewesite.net to make your Web site accessible with a custom corporate domain name, so you might be interested by this post.
Hope This Helps! Cheers