Running EPiServer CMS on the Azure VM Role, part one
This blog post is about running EPiServer CMS on the Windows Azure Virtual Machine (VM) Role and the challenges that follow. The approach is expirmental and not officially supported by EPiServer. I strongly recommend that you do not use this for production scenarios.
A few words about the VM Role
The VM Role is the latest addition to Windows Azure. It is aimed towards running applications that require long and complicated installations on Windows Azure. By this devise the VM Role is geared towards migrating legacy systems onto Windows Azure.
The VM Role is part of the computing part of Windows Azure. This has an impact on the cost model as Microsoft charges by the hour for computing time. Also, you need a Windows Server 2008 license when creating the Virtual Machine that’ll the VM Role will run. This is not the case of the Web or Worker Role as Microsoft abstracts the operating system for these.
Then why the VM Role?
For those who have been following this blog series know that there are a few challenges in successfully running EPiServer CMS on the Windows Azure Platform. Please read the blog post Half-time with EPiServer CMS on Windows Azure. This post explains the approach with EPiServer CMS and the VM Role.
At the time of writing this blog post the VM Role program is still in Beta. You need to sign up to join the program through the Windows Azure Portal. When you’ve been accepted into the program you’ll receive a notification e-mail along with a registry fix that enables the VM Role in Visual Studio.
The components you need:
- Windows Azure SDK + Tools
- Windows Server 2008 R2 with Hyper-V
- EPiServer CMS
- Windows Azure account
- Coffee of choice
We use Hyper-V to create the Virtual Machine that will be deployed to Windows Azure. Hyper-V is shipped with Windows Server, which means that you’ll need a Windows Server installation with Hyper-V.
You can’t use VMWare
I thought I had a great idea. Why not run Windows Server 2008 R2 with Hyper-V on VMWare? Virtualization within virtualization, right? It’s not like Inception. It doesn’t run slow. It simply doesn’t work. Simply put Hyper-V needs direct access to the CPU virtualization technology. Hopefully this might save someone time. In hindsight this was just a bad idea which should have been googled beforehand.
Setting up Windows Server 2008 R2 with Hyper-V
Reformatting my laptop running Windows 7 was not an option. Instead I opted to resize my main partition and install Windows Server 2008 R2 on the space made available. From there it was a simple enough task to create a bootable USB-drive and install Windows Server 2008 R2 from there.
Once Windows Server 2008 R2 is installed apply the latest updates from Microsoft.
Install the IIS Role and the Hyper-V Role. See images below.
Install the IIS Role and the Hyper-V Role
Download and install the Windows Azure SDK and Tools. Next enable the ASP.NET Role Service for the IIS Role. See image below.
Install the ASP.NET Role Service for the IIS Role
Now we’re ready to create the EPiServer CMS Virtual Machine.
Note: If you are using WLAN to access any resources then you need to install the feature “Wireless LAN Service” from the Server Manager. See image below.
Install the feature Wireless LAN Service
Creating the EPiServer CMS Virtual Machine
If you’ve used Hyper-V to create and manage Virtual Machines before then this is not anything new. For those that are unfamiliar with this here’s a quick guide.
To access the Virtual Machine we need to create a virtual network using the Virtual Network Manager in the Hyper-V Manager Tool. Create an internal network. If you’re using WLAN then you need to share the connection with the new virtual network. See images below.
Create an internal network to be used with the Virtual Machine
Next select New from the Actions-panel. See image below.
Create a new Virtual Machine using Hyper-V Manager
Use the default settings and select the Virtual Network we created. Also, the size of the Virtual Hard Disk should be 8gb. The maximum size for the Extra Small VM Role is 16gb. Finally select the Windows Server 2008 R2 ISO. See images below.
Virtual Machine settings
When the Windows Server 2008 R2 installation has finished we need install the Windows Azure Integration Components, EPiServer CMS, finalize configuration and prepare the Virtual Hard Drive for Windows Azure using the sysprep-tool.
Finalizing the Virtual Machine for Windows Azure
To run the Virtual Machine on Windows Azure we need to install the Integration Components. This is done mounting an .ISO for the Virtual Machine from the SDK-folder. See image below.
Mount and install the Windows Azure SDK
Install all the prerequisites for EPiServer CMS as well as the EPiServer CMS application files using the downloaded installation package. From the deployment center install a new EPiServer CMS website.
When you install an EPiServer CMS website you need to select a SQL Server. I strongly advice against using a SQL Server located on the Virtual Machine – I will go into more detail about this later.
Instead – if you haven’t done so already – create an EPiServer database on SQL Azure. The instructions to do so can be found in my blog post Creating the EPiServer database on SQL Azure.
Configure EPiServer CMS to use this database in ConnectionStrings.config. Remember to open the firewall on the Windows Azure portal to accept connections from the public IP of your Virtual Machine. You can check what your IP is on the site http://whatismyipaddress.com/.
Any further configuration (creating login accounts, adding files, etc) must be done before uploading the Virtual Hard Disk to Azure. So take your fresh EPiServer CMS website for a proper testrun before moving on.
Now we’re ready to prepare the Virtual Machine for Windows Azure. We use the sysprep-tool that ships with the Windows SDK to do this. Basically we prepare the operating system to be run for this time. A unique SID is generated and a mini-setup is performed when the Virtual Machine is restarted. See images below on how to run sysprep.
The Virtual Machine now shuts down and we’re ready to upload the Virtual Hard Drive to Windows Azure! On to part two!
Again I would like to point out that this is experimental and not meant for any production environment. The purpose of my work with EPiServer CMS and Windows Azure is to inspire, challenge and drive the CMS and architecture for the web forward together with the awesome community EPiServer has.