Migrating WordPress web site to Azure


From the IT prospective a WordPress web site requires:

  • A web server like Microsoft IIS or Apache
  • PHP
  • mySQL database

Migrating a WordPress website includes copying all its files/folder structure, and its mySQL database, and changing the wp-config.php file to point to the new mySQL database. These tasks could be complicated for a large site and may require specific skills related to web site configuration and mySQL database administration. This post goes over a very simple way to migrate a WordPress web site to Azure, using the Duplicator WordPress plugin.

Executive Summary

  • Add Duplicator WordPress Plugin
  • Create New Package
  • Create new Azure WebApp
  • Add mySQL database
  • Upload the Duplicator package to the new Azure WebApp
  • Run the Duplicator Package Installer

Add Duplicator WordPress Plugin

If you don’t have it already, add the WordPress Duplicator Plugin. On the Plugins page click Add New

WP01

Search for Duplicator, click Install Now

WP02

Create New Package

Click on Duplicator link on the left, then click Create New

WP03

Accept the defaults and click Next to scan your WordPress site

WP04

Duplicator scans your current WordPress site

WP05

and displays the result like:

WP06

In this example, I have a couple of warnings about large site size, and some large files. I check the box and click Build.

WP07

Duplicator builds the package:

WP08

The package consists of an Installer (installer.php file) and Archive (.zip file). I download both to my desktop. The zip file contains all the WordPress site files and folder structure + a scripted copy of the associated mySQL database

Create new Azure WebApp

In the Azure Portal, click New/Web+Mobile/Web App

WP09

In the Web App blade I type in the new Web App name ‘MyWebApp407’ which must be unique under .azurewebsites.net. I pick the Azure subscription from the Subscription drop down menu. I choose to create a new Resource Group. I give it a name; ‘MyWebApp-RG’. I click the arrow to create a new Service Plan

WP10

In the App Service Plan blade (middle) I click Create New,  type in MyWebApp-SP as the name, select East-US and accept the default Pricing teir of S1 Standard.

Finally, I click OK and Create

In a few minutes Azure complete MyWebApp deployment

WP11

Add mySQL database

I browse under Resource Groups/MyWebApp-RG, and click Add

WP12

I search for mySQL, and select MySQL Database by ClearDB

WP13

and click Create

WP14

I give it a name ‘MyWebAppDB’ (avoid using other than alphanumeric characters in DB name), pick East US for the location, click the arrow and OK to accept the terms, and finally click Create

WP15

Click Refresh and note the new blank mySQL database:

WP16

Upload the Duplicator package to the new Azure WebApp

If you browse to the new web site now you may see a temporary page like:

WP17

First zip the 2 files downloaded from the Duplicator Package above into 1 file:

WP18

Next browse to the KUDU page http://MyWebApp407.scm.azurewebsites.net

Click CMD under the Debug Console menu

WP19

Browse to d:\site\wwwroot

WP20

Drag the zip file from prior steps and drag it on the right side as shown below:

WP21

Azure will upload

WP22

and unzip the file

WP23

Run the Duplicator Package Installer

Browse to the installer.php file as in http://mywebapp407.azurewebsites.net/installer.php

You will see a page similar to

WP24

Back in the Azure Portal, click MyWebAppDB/Properties

WP25

Note the Database Name, Hostname, username, and password

WP26

Back in the installer.php screen, enter the required information as shown below:

WP27

Click ‘Connect and Remove All Data’, click ‘Test Connection’, check the box to acknowledge the notices, and click ‘Run Deployment’

Click OK to continue..

WP28

The installer extracts the Duplicator Package zip file restoring the file system and rebuilds the mySQL database from the script contained in the zip file

WP29

Accept the defaults and click Run Update

WP30

The Installer makes the selected changes to the WebApp config files

WP31

Follow the installer instructions to do final testing:

WP32

Step number 2 above is actually important. Clicking on the link next to ‘2.’ above will take you to the site admin login page:

WP33

Use the same credentials from the original site.

Adjust your permalinks setting as it is on the original site.:

WP34

As a last step, once the site users have tested that everything looks OK, add a custom domain to the site and switch the domain DNS records to point to your new Azure site.

 

 

 

 

 

 

Advertisements

2 responses

  1. Thanks for your detailed walkthrough ! It gave me the push to move my blog from wordpress.com to Azure, with a custom domain name. I must confess that I struggled a bit with the database part… so I deviated a bit from your walkthrough. Actually I found a simpler way : click New, and in the search filed type “Wordp”, and select WordPress (instead of click New/Web+Mobile/Web App). This way, Azure does all the technical stuff : it create the database (drawback is that you have to export the .xml from your old site, and import it in the new site). But using ClearDB, I could benefit from “Mercury tier” pricing, which is cheaper.
    Since I am new to this, I was wondering if there are benefit to following your method (or simply if the one I found was not yet available last year when you wrote this post) ?
    Thanks for your advise.

    July 26, 2017 at 2:43 pm

  2. Karen Dean

    Thank you for the detailed instructions – this looked like it would be a simple process. Unfortunately I have come to a dead-end with trying to get the migrated app to be able to connect to the new ClearDB database I created in the ARM portal…I triple checked the credentials provided in Azure Properties for the new DB; the Test Connection to the database was successful – but when I tried to login to the new migrated website, I get the warning ‘Error establishing a database connection.’

    The database is empty when I checked Usage > Database Size in the portal.

    Any ideas on what went wrong. I did read a note on the Duplicator Forum that ClearDB uses a different connection string ‘in the background’ … not much chance in getting help there.

    Our websites have about 15 plugins and a premium theme that I want to be able to quickly clone and migrate…I don’t mind having to import the xml content file in, but don’t want to have to rebuild the websites from the bottom up.

    Have you successfully migrated more than one active WordPress in Azure?

    August 7, 2017 at 5:20 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s