Running EPiServer CMS on the Azure VM Role, part two
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.
Create a certificate
In order to be able to upload the Virtual Hard Drive to Windows Azure we need to have a valid certificate installed locally and on Windows Azure.
If you haven’t created a certificate then you need to do so now. First we need to create the certificate using the MakeCert-tool that ships with the Windows SDK. Below is the MakeCert-command needed to create a valid certificate.
makecert -r -pe -a sha1 -n "CN=Windows Azure Authentication Certificate" -ss My -len 2048 -sp "Microsoft Enhanced RSA and AES Cryptographic Provider" -sy 24 windowsazure.cer
Create the certificate
Next install it to the local store and subsequently upload it to the Windows Azure Portal.
Install the certificate locally and on Windows Azure
Upload the Virtual Hard Drive
With the certificate in place locally and uploaded to the Windows Azure Portal we’re ready to set the connection and upload the Virtual Hard Drive.
We use the csupload-tool when uploading Virtual Hard Drives to Windows Azure. This tool is part of the Windows Azure SDK. So we begin by starting an Azure SDK Command Prompt. See image below.
Start the Windows Azure SDK Command Prompt
Next you need to go to the Windows Azure portal and copy your subscription ID and certificate thumbprint. We’ll need these when setting the connection for csupload.
Copy the subscription id and certificate thumbprint
The csupload-commands are as follows.
csupload Set-Connection "SubscriptionId=SubscriptionId;CertificateThumbprint=CertThumbprint"
csupload Add-VMImage &ndash;LiteralPath EPiServer.vhd &ndash;Location "North Europe" &ndash;Name EPiServer.vhd
The csupload tool
When the tool finishes we have successfully uploaded our Virtual Hard Drive to Windows Azure.
Create the Virtual Machine Role using Visual Studio
Next we need to create the VM Role that will run our Virtual Machine. This Role is responsible for the number of instances, endpoints, diagnostics and how the Virtual Machine can be accessed.
If you haven’t done so already you should run the registry script that was sent with the notification e-mail that you’re account is enabled to use the VM Role.
Run the registry script which enables the VM Role in Visual Studio
Next create a standard Windows Azure Project in Visual Studio. Do not add any roles to the project. See images below.
Create Windows Azure Project in Visual Studio and keep the Roles empty
Having run the registry script we now have access to the Virtual Machine Role. Right click the Roles-folder in the Visual Studio Project and select Add, New Virtual Machine Role.
Add a new Virtual Machine Role
We select our Windows Azure account and the Virtual Hard Drive we just uploaded. The VM Role requires at least two instances to run. This is because there must be a fail-over if the Azure Fabric for one of the VM Roles suffers a catastrophic failure. See images below.
Selecting the Windows Azure account, VHD and setting the instances
Next we need to set an endpoint for which the VM Role can be accessed. We need an HTTP endpoint running on port 80. Configure the endpoint as shown below.
Setting the HttpEndpoint
With this we’re done with the configuration of the VM Role.
Publishing the VM Role
Right click the project and select Publish. Select the Azure account to publish to, deployment environment and storage account. Before we click OK we need to configure Remote Desktop connections. See image below.
Configure Remote Desktop connections…
We need to create a new certificate for the Remote Desktop connections. Enter the username and password. These credentials will be used when using Remote Desktop access – write these down!
Check the Enable connections for all roles checkbox. Next we need to export the new certificate – we do this by clicking View and then select Copy to file on the Details tab. See images below.
Create certificate for remote desktop connections
Add certificate to the hosted service
Now we’re ready to publish. Click OK on the Publish-dialogue. If all goes well the process should look as below. Be patient; it takes a while for the Virtual Machines to initialize.
Virtual Machine initialization in the Windows Azure portal
That’s it! You’re now running EPiServer CMS on the VM Role. Note that the MAC-address for our license is no longer valid since this is a dynamic aspect of Windows Azure.
EPiServer CMS running on the VM Role
Managing the Virtual Machines in the Portal
From the Windows Azure Portal you can now manage the Virtual Machines. You can, among other things, specify how many instances that should be propagated behind the load balancer. See image below.
Manage the number of virtual machine instances in the portal
We also have Remote Desktop access to our virtual machines. Simply select the instance you want to connect to and click Connect.The Remote Desktop session will use the certificate and credentials we created earlier.
Remote desktop access to our virtual machines
Running EPiServer CMS on the Virtual Machine Role of Windows Azure presents a few challenges. I have adressed a few here, but there are more still. Also, there are a few key parts to the VM Role that need to be highlighted. I’ll deal with these in an upcoming post. Thanks for reading so far.