blob

Setting Up Shop in Windows Azure

Several months ago after numerous outages with my old American web host, I moved some of my sites over to a UK hosting company. For this reason and that reason, I didn’t complete the migration of all of my sites over to the UK host and the time is upon me that the agreement with the old American host is up for renewal in a couple of weeks.

After some persuasion, I’ve managed to convince a the other half that some of the sites could be dropped as they just weren’t used anymore – Just one site left to sort and that’s in the hands of a friend to arrange.

This left me in a position where I only had one site of my own left, this blog. When I was first reviewing options for moving to a new host, I looked at Windows Azure. I’m working with Azure heavily in a project at work so I was comfortable with the environment enough to want to deploy a multi-language enterprise site there so why not my own sites? Well at the time, cost was an issue. To run all of my sites in Windows Azure Web Sites Shared mode would have cost about three times as much as the hosting agreement elsewhere. This is down to the fact that in Windows Azure to use a custom domain name you need to be on either the Shared or Standard tier; the Free service tier limits you to using *.azurewebsites.net addresses.

So with just one site left my thoughts returned to Azure. I did some sums and it looked like it was going to cost about the same for Windows Azure as it was going to, to renew the UK plans but on a way more solid platform which tonnes more features, scalability and support. Not to mention that Windows Azure services outperform those of its competitors up to 3x if you believe the hype (I do for the record). I’m hedging my bets actually on my costs being lower. The Windows Azure Pricing Calculator puts a Shared Web Site at £6.16 per month but that’s based on 684 hours (28 days @ 24 hours per day) of compute time as Windows Azure now calculates billing based on hours of compute time. As my blog isn’t visited that heavily and I’m using the amazing WP Super Cache plugin for WordPress, I think I can do it for about half of this actually but month one will tell – I’ve always got the bug out option with Azure as I’m on pay as you go monthly with no upfront commitment.

So after migrating the MySQL database in the ClearDB free 20MB database service which fits perfectly for my MySQL WordPress instance database at a wee 9MB and after copying over all my files and doing some WordPress PHP magic to move some of the URLs I had it working. Makes you realise how quickly WordPress moves though! I was already two versions behind the latest and all of my plugins were out of date so first job was to fix those which I did in quick order.

Custom Domain registration is a simple case of configuring a few CNAME records and updating my domain root A record and done. My registrar FastHosts have a great interface for updating DNS and they use a 1 hour TTL which means that the updates happen really quick although one thing I think Microsoft are doing actually is that they are performing live queries each time and not relying on cached DNS entries and potentially long TTL times. I updated my A record and Azure knew about it within about a minute of the change.

So surely I did more than just move host and upgrade? Damn right I did 🙂

I’ve finally fixed the Twitter hook on the blog which means my latest tweet is now actually shown. This was fixed by replacing the Twitter plugin I am using with one which actually works with the new Twitter oAuth developer framework. I’m now using Advanced Twitter Feed Integration if anyone else out there is looking for a Twitter plugin that works. I’ve removed the old jQuery Lightbox plugin as the new version of WordPress has improved this functionality so renders it pointless. In a more functional space, I’ve fixed the CSS which was causing issues with the collapsible navigation from working properly so you’ll now actually be able to read the text as well as see the pretty Windows Phone inspired plus and minus buttons. I’ve also updated my permalink structure to drop the year/month/day element. My URLs are now simply the domain plus the post name. Much cleaner and the chances of me wanting to recycle a post name are slim to zero so it shouldn’t come back to haunt me.

The coolest thing I’ve setup is the Windows Azure Storage for WordPress plugin. I’m not sure what my mileage with this but I’ll give it a month or two and see – purely a cost factor though, not functional.

This plugin connects to a Windows Azure Storage Account and stores content that you upload to the blog into Windows Azure Storage BLOBs instead of directly into the Web Site instance. This is good news in theory because it offloads transactional tasks and storage from the web instance giving me the potential to reduce my compute time on the web instance and it also allows me to use the Azure CDN feature for even more massively improved performance if I wish (although the performance is pretty awesome already). Configuration of the plugin is super simple thanks to the fact that the plugin is actually written by Microsoft and once connected to the Storage Account Container and enabled, anything you upload either in the web interface as media or via a third-party editor like pictures, videos or other post content get’s stored out in the Storage Account Container. Simples.

How to Delete a VHD BLOB on for an Azure VM

A while ago I signed up for a 3 month trial for Microsoft Azure to allow me to continue to use the Azure Backup service after Microsoft moved it from Windows Azure Online Backup Preview into a more mainstream service.

Last night I decided to have a play whilst I’m still on the trial to see how quickly I could stand up a Windows Server 2012 VM instance. The answer is quickly by the way. Within five minutes, I was able to download the .rdp file and connect to the machine, but I digress.

After I was finished, I deleted the VM, but the disk remains in the event that you want to reattach it to another VM. When I tried to delete the .vhd file I got an error that it was still in-use. I wasn’t able to find the answer initially, but after a post on TechNet someone came straight back with the solution in an Azure Technical Support (WATS) blog post at http://blogs.msdn.com/b/windows_azure_technical_support_wats_team/archive/2013/02/05/iaas-unable-to-delete-vhd-there-is-currently-a-lease-on-the-blob.aspx.

In a nutshell, although the VM is deleted, it leaves behind a disk mount resource which is used to link the VM to the VHD BLOB. Follow the steps in the post to delete the link an you will be given an option to delete the actual .vhd file as well as the link. Job Done.