Chris Risner . Com

Deploying WordPress on Azure and using MySQL in a VM

Posted on: 6/17/2014 6:20:00 PM by

Recently I sold my old sailboat and purchased a new (to me) one.  With this new, larger, and older boat, I wanted somewhere for my wife and I to post about working on the boat as well as our (hopefully awesome) sailing adventures.  While I wrote and continue to maintain the blogging engine that powers this site, I really wanted to play around with a more mainstream blogging engine for the new site.  I asked the Twitter community for suggestions on engines to check out and received quite a few: Ghost, GitHub Pages, Tumblr, Squarespace, Jekyll, Ghost, and WordPress. 

Some of the requirements I had for the new site included:

  • Minimal coding needed to get going (I already code enough on this engine)
  • Theming support with publically available themes (I’m terrible at art)
  • Support for multiple authors (my wife wants to be able to post as well)
  • A decent web based post editor
    • Back when I started with Veritas, the options for web based HTML editors that you could embed was pretty weak (the one I had been using produced really poor HTML / CSS).  I know this is something that has gotten better and I’d like to not be tied to Windows Live Writer like I am with this site.
  • Good URL SEO (I don’t want URLs to contain a year and a month and a blood type)
  • Rich plug-in support (this goes back to me not wanting to code a lot)
  • Mobile support (this was a stretch but being able to admin the site from my phone would be nice)
  • Custom domain support
  • Runs on Azure (why would I put it anywhere else?)

After figuring out what I wanted and taking a look at all of the suggested solutions, and a few others, I came down to one winner.  Before we get to the winner, let’s talk about the non-winners.

  • GitHub Pages
    • This is essentially free web hosting inside of your GitHub repo.  You can create a page for your organization and / or for a specific project.  Additionally you can do custom domains.  Where this appears to fall apart is the theming, plug-ins, and more advanced features.  I know a lot of people using GitHub pages and think they’re great for things that are either more simple or if you have more resources (i.e. a designer) but I have neither.
  • Tumblr
    • I probably spent the least time evaluating Tubmlr but it didn’t seem to fit my needs based off of what I’ve seen whenever I view someone else’s Tubmlr site.
  • Squarespace
    • This is a newer service that I had not heard of before.  They have some really great templates to select from but it really seems more intended for either a company’s site or maybe a celebrity’s.  I’m neither and the real nail in the coffin is that they charge.  They were kind enough to tweet back to my above mentioned message and say there is a free trial but I’m not interested in paying for the site today.
  • Jeykll
    • Jeykll is a static-site generator that is written in Ruby and is used for many blogs including my friend Justin’s site, Carpeaqua.  Additionally this plugs into GitHub Pages for free hosting.  This gets into some of the same issues with GitHub Pages.  I don’t want to deal with the code or CSS or figuring that stuff out.
  • Ghost
    • Ghost is another new blogging platform that seems to be getting a lot of attention as of late.  There are lots of themes available, you can easily deploy a Ghost blog to Microsoft Azure, it’s used on some heavily visited sites, and is gaining in popularity.  Unfortunately it’s still new so plug-in support and extensibility might be an issue.  I could probably extend anything not there myself but, (are you sensing a recurring theme) I don’t really want to deal with the code.


At the end of the day, WordPress ended up being the winner.  I’ve played with WordPress before but it’s been a few years since I looked at it in any depth.  Some of the factors that lead to WordPress’s winning (aside for everything else not winning) included:

  • Completely open source.  This is a solution that can be hosted anywhere including…
  • Super easy deployment to Azure.  WordPress is in the Azure Web Sites gallery so you can deploy a new WordPress blog on Azure in a couple minutes.
  • Multiple author support
  • Mobile app support (even if the site isn’t running on
  • Themes (tons of themes as well as info on customizing those themes).
  • Custom domain support (which Azure also supports (outside of free mode)).
  • URL SEO options
  • Plug-ins.  There are tons and tons of plug-ins.
  • A good web-based HTML editor (in addition to an editor in the mobile app).

Deploying WordPress on Azure

Once you’ve signed up for a FREE Azure account, it really is super fast deploying WordPress.  After logging into the Azure Portal, click the New button at the bottom left.  Under Compute, select WEB SITE, and then FROM GALLERY.  A new window will appear with all of the different options for web site apps that you can deploy.  At the bottom you’ll find WordPress.  You’ll next get to the Configure page where you can specify the URL of your site, what database to use (more on this soon), and a bunch of deployment settings (Auth key, Secure Auth Key, Logged In Key, etc):

To fill all of the deployment settings, it’s useful to use’s provided value generator.  The last step before deployment is to create a new database or select an existing database.  We’ll talk more about that shortly.  After that the deployment starts.  After a minute, you can then browse to the site and complete WordPress’s initial configuration.  From there, you’re done.  You can do any theming you want or add any additional plug-ins or just start blogging.

The MYSQL Database

Out of the box, WordPress relies on MySQL for it’s data storage.  Microsoft Azure doesn’t provide MySQL like it provides SQL Database (based off of MS SQL Server) but relies upon a partner, ClearDB, to provide MySQL databases on Azure.  From a developer perspective, this is all abstracted away from you when you generate your WordPress blog.  A MySQL DB is generated that is running in Azure and is tied to your WordPress site.  However, when you are looking at cost and size of the DB, this system becomes a bit more of an issue.  ClearDB has their own pricing for your MySQL databases running on Azure.  The one generated when you create your first WordPress site is free and will continue to be free up to 20 MB.  When you want to go above that, the first plan (up to 1 GB a month) is $9.99.  That’s more than I want to pay.  Additionally, I don’t like having complete control over my database. 

Other Options

I still wanted to stick with WordPress on Azure, but I wanted another option for my database.  The first thing I stumbled upon was this post on connecting WordPress on Azure to SQL Server instead of MySQL.  This seemed great.  I’m already using a SQL Database in Azure for this site.  All I would need to do is generate a new database on my server and point my WordPress site to it (after porting the data / schema).  I was pretty excited about how easy that sounded but, not being super comfortable with WordPress or the underlying PHP code, I wanted to ask someone that knew these things a bit better first.  Thankfully, Cory Fowler, is super knowledgeable at all of these things.  Cory let me know that while it would indeed work, the issue was that while the WordPress code itself would work fine with SQL, any plug-ins would potentially have to be tested or recoded to work with SQL.  This strongly violated my “I don’t want to code a lot” requirement.  Thankfully there was another option: running MySQL on a VM!

MySQL on a VM

I’m far from an IT admin, but I’ve worked enough with Windows Server and Windows to be comfortable moving around it.  This meant that my fear of dealing with a Virtual Machine was low.  I quickly found this guide on Installing MySQL on a Virtual Machine Running Windows Server 2008 R2 in Azure.  I choose to use Windows Server 2012 instead of 2008 but it was very easy to go from this guide to 2012 without much work.  I had already setup my WordPress site and didn’t want to reconfigure it, so I really needed to get a backup of my ClearDB database and restore that to my MySQL server in the VM.  To do so, I first downloaded the MySQL Workbench tool.  You can write all of the queries yourself but Workbench makes it much easier.  Next, go to the Azure portal and navigate to your WordPress site’s Linked Resources tab.  Clicking on the name of your database will take you to the ClearDB portal.  Here you can click on the Endpoint Information tab:

Take this information and open MySQL Workbench.  From the home screen, you should see Server Administration on the right side.  Select New Server Instance below that.  Enter the Hostname from above into the Remote Host Address in Workbench and click Continue.  At the next screen, copy over the Username and click Continue.  After finishing the wizard, double click the new instance and you should be taken to an Admin page.  Select Data Export from the left side, select your database, ensure all tables are checked, select a place for the output file and start the export:

Once the export is complete.  You can go back to the home screen and add the MySQL server on your VM as a new instance.  After getting to the admin screen for your new MySQL server, go to the Data Import / Restore section and import from the local file you generated with the export.  Start the import and your new DB will be available. 

Changing the WordPress Config

The last change you have to make is to the WordPress source code.  The easiest way I’ve found to do this is to return to your site in the Azure portal and go to the Dashboard tab.  On the right hand side under QUICK GLANCE, you should see an FTP Host Name link.  Open this link in FTP and use the DEPLOYMENT/FTP_USER username and the password you’ve set up (you should see a link to set or reset your credentials if you don’t have them) to connect.  Once you’ve connected, open the site directory and then wwwroot.  You’ll want to pull down the wp-config.php file.  Once you do, open that file and enter the correct values in the db_name, db_user, db_password, and db_host.  Save these changes and copy the file back to your site via FTP and that’s it, you’re done.


It’s amazingly easy to get WordPress running in Microsoft Azure via the Web Sites gallery and ClearDB’s MySQL service.  Today we’ve seen that if you really want as much control as possible, you can roll your own MySQL server in a virtual machine running on Azure.  I should add that this VM usage isn’t free (not like the free 20 MB ClearDB MySQL server).  That said, with the low usage I’m expecting for the site I’m running on a super small VM which even with the additional cost of storage, is a bit over $10 / month.  I’ve scaled the site up (it’s on the same hosting plan as this site) so there’s a separate cost for that, but at the end of the day, I’m paying very little for a super reliable site.  That’s all there is to it, you can check out the new blog at

Categories: Azure, Blogging, Boats, Open Source, PHP
Bookmark and Share
First Article

TechEd North America 2014

Posted on: 5/20/2014 10:20:00 PM by

Last week I flew out to Houston, Texas to attend this year’s TechEd North America conference.  TechEd is the big Microsoft conference for IT Professionals and Enterprise Developers.  The big difference between this conference and the Build conference we just had is the technology focus.  While TechEd really does have an Enterprise focus, Build is centered around development (whether it’s Enterprise or Commercial or what have you).  At this year’s conference I delivered two sessions.

Java on Azure

This session explained the different ways you can host or run Java on Azure.  Together with Brian Benz, we went over the following topics:

  • Running Java on VMs (Oracle, Linux, Windows Server)
  • Running Java on Platform-as-a-Service (Cloud Services and Web Sites)
  • Accessing Azure Software-as-a-Service features with Java (tons of stuff)

This session wasn’t super coding deep but was really mostly an overview.  There isn’t a ton of focus on Java at TechEd (shocking I know) so instead of trying to go deep into one specific area, we tried to give everyone a general idea of their options for Azure and Java.  You can check out the video for the session here:

High-Volume, Low Latency Mobile Push Notifications

The second session I did covered how to use Azure Notification Hubs to do push notifications down to Mobile apps.  This session included some really cool topics like:

  • Registering with Hubs and pushing notifications
  • Registering with Tags and pushing to specific tags
  • Tag expressions
  • Geo-based push
  • Template based registration
  • Server vs Client registration

I really enjoyed this session because I was able to demonstrate Notification Hubs working with iOS, Android, and Windows Store apps all at once!  There was a lot of code used and walked through as part of this session so I posted it all, along with a brief walkthrough on setting it up, on GitHub.  You can check out the video for this session here:

If you have any questions or feedback about either of the sessions, please let me know.

Categories: Azure, Conferences, Microsoft
Bookmark and Share
First Article