Installing Umbraco on Azure

Every two weeks we ask members of the community to submit technical articles to the MSDN Flash, but I felt a little guilty about asking people to sacrifice a few hours of their own time if I wasn't willing to do it myself. Therefore, for your reading pleasure, I have rustled up the following article about my experience putting Umbraco on Azure. If you can spare a few hours and fancy writing an article for the MSDN flash send your idea to me at martin.beeby@microsoft.com.

Putting existing applications on Azure that have not been developed with Azure in mind can be tricky, but it is possible. This is the main lesson I learned when I tried to get one of the best OpenSource .net content management systems to play nicely with my little piece of the Azure cloud.

Umbraco is a great CMS. It’s infinitely customizable and ever since being introduced to it last year, I have been hooked. So when I was asked to build a new website for one of our marketing teams, the combination of Azure and Umbraco seemed irresistible.

If you want to try the method I describe in this post yourself, there are some free 30 day Azure on Umbraco trials that you can sign up for here. Just use the Promotional Code UMBUNI. If you have never tried Azure before and want to learn more you should start here

After some initial reading I realised there was a project dedicated to getting Umbraco working on Azure, so I headed over to CodePlex where the Umbraco Azure Solution Accelerator is hosted. The project has been set up to enable developers to move their Umbraco applications to Azure and it provides tools and documentation to make the process simpler (notice I didn’t use the word easy).

At the time of my visit there were two main documents “Getting Started” and “The Umbraco Configuration & Application Definitions Guide.” The “Getting Started” document gives you step by step instructions on how to configure the Accelerator project, how to set up your Azure account, and finally how to upload and publish the compiled site. The “Umbraco Configuration & Application Definitions Guide” explains the meaning of all the various project configuration options and is extremely handy when you are configuring the Application definition.

The first steps are:

  • Download a copy of Umbraco
  • Download the Azure accelerator Project
  • Add your Azure storage credentials to the AccelartorWorkerRole.
  • Configure some settings and create two endpoints for the WorkerRole (80 and 8080)
  • Configure the Application Definition (umbraco.config) file. I used the “The Umbraco Configuration & Application Definitions Guide” to understand what all of the various options were.
  • Build the solution

It was at this point that my build failed. With the following error:

WAT070 : The referenced assembly … AcceleratorWorkerRole.dll was not found.

I had placed the solution inside a folder that contained a space and an xcopy command that was fired by the build events had fallen over. It was a simple problem to solve; I just wrapped the File Paths contained in the build events in speech marks. I documented this fix over on Codeplex.

Once the project is built there are now two steps to publish. Firstly you will need to publish Umbraco to Azure storage as a cloud drive. Secondly you will need to upload the Accelerator Engine WorkerRole (which we configured earlier) to Azure. This WorkerRole will mount the drive to your Azure instance and make the configurations necessary to run Umbraco.

Uploading Umbraco to Azure storage

The steps to do this are detailed in the getting started document, but fundamentally you use the AccelCon project that we configured and built earlier. You run this application using the Azure SDK console window and it builds a Virtual Hard Disk (VHD) which it then uploads to Azure cloud storage using the Azure storage credentials that you specified earlier on.

This worked fine the first time, although I had a few problems with this when I repeated the process. It seemed that the temporary VHD that this process creates is not detached after use; I therefore had to delete it manually using the Disk Management section of the Computer Management console.

clip_image001

The process of uploading took around 10 minutes over my home broadband I was then ready to move on to the next step and publish the Accelerator Engine.

Publishing the Accelerator Engine

This part is the simplest section and will be familiar to anyone that has put an application on Azure before. All we do is log into our Azure portal, create a hosted service, configure the URL of the service and then upload the two files generated by the publish command on the context menu of the AcceleratorService.

clip_image003

Creating a service using the new Silverlight web portal is painless enough, but if you want you can also integrate the publish process into Visual Studio 2010. Personally speaking I prefer to use the web portal.

clip_image005

Now when you go to the URL you will be able to configure the Umbraco installation. One of the steps in this process involves connecting your database. I used my existing SQL database as a backend, however, if you want to use SQL Azure you can and there are instructions on how you migrate your database to SQL Azure over at the Umbraco community site.

So that’s how you get Umbraco running on Azure. During the process I spoke to both the core Umbraco team and the Azure team and I’m assured that the next version of Umbraco, which should be released sometime this year, will have better support for Azure. Publishing will hopefully be a case of simply publishing the application rather than going through the hassle of mounting the VHD.