The Proper Use of the VM Role in Windows Azure

At the Professional Developer’s Conference (PDC) in 2010 we announced an addition to the Computational Roles in Windows Azure, called the VM Role. This new feature allows a great deal of control over the applications you write, but some have confused it with our full infrastructure offering in Windows Hyper-V. There is a proper architecture pattern for both of them.


Virtualization is the process of taking all of the hardware of a physical computer and replicating it in software alone. This means that a single computer can “host” or run several “virtual” computers. These virtual computers can run anywhere - including at a vendor’s location. Some companies refer to this as Cloud Computing since the hardware is operated and maintained elsewhere.


The more detailed definition of this type of computing is called Infrastructure as a Service (Iaas) since it removes the need for you to maintain hardware at your organization. The operating system, drivers, and all the other software required to run an application are still under your control and your responsibility to license, patch, and scale. Microsoft has an offering in this space called Hyper-V, that runs on the Windows operating system. Combined with a hardware hosting vendor and the System Center software to create and deploy Virtual Machines (a process referred to as provisioning), you can create a Cloud environment with full control over all aspects of the machine, including multiple operating systems if you like. Hosting machines and provisioning them at your own buildings is sometimes called a Private Cloud, and hosting them somewhere else is often called a Public Cloud.

State-ful and Stateless Programming

This paradigm does not create a new, scalable way of computing. It simply moves the hardware away. The reason is that when you limit the Cloud efforts to a Virtual Machine, you are in effect limiting the computing resources to what that single system can provide. This is because much of the software developed in this environment maintains “state” - and that requires a little explanation.

“State-ful programming” means that all parts of the computing environment stay connected to each other throughout a compute cycle. The system expects the memory, CPU, storage and network to remain in the same state from the beginning of the process to the end. You can think of this as a telephone conversation - you expect that the other person picks up the phone, listens to you, and talks back all in a single unit of time.

In “Stateless” computing the system is designed to allow the different parts of the code to run independently of each other. You can think of this like an e-mail exchange. You compose an e-mail from your system (it has the state when you’re doing that) and then you walk away for a bit to make some coffee. A few minutes later you click the “send” button (the network has the state) and you go to a meeting. The server receives the message and stores it on a mail program’s database (the mail server has the state now) and continues working on other mail. Finally, the other party logs on to their mail client and reads the mail (the other user has the state) and responds to it and so on. These events might be separated by milliseconds or even days, but the system continues to operate. The entire process doesn’t maintain the state, each component does. This is the exact concept behind coding for Windows Azure.

The stateless programming model allows amazing rates of scale, since the message (think of the e-mail) can be broken apart by multiple programs and worked on in parallel (like when the e-mail goes to hundreds of users), and only the order of re-assembling the work is important to consider. For the exact same reason, if the system makes copies of those running programs as Windows Azure does, you have built-in redundancy and recovery. It’s just built into the design.

The Difference Between Infrastructure Designs and Platform Designs

When you simply take a physical server running software and virtualize it either privately or publicly, you haven’t done anything to allow the code to scale or have recovery. That all has to be handled by adding more code and more Virtual Machines that have a slight lag in maintaining the running state of the system. Add more machines and you get more lag, so the scale is limited. This is the primary limitation with IaaS. It’s also not as easy to deploy these VM’s, and more importantly, you’re often charged on a longer basis to remove them. your agility in IaaS is more limited.

Windows Azure is a Platform - meaning that you get objects you can code against. The code you write runs on multiple nodes with multiple copies, and it all works because of the magic of Stateless programming. you don’t worry, or even care, about what is running underneath. It could be Windows (and it is in fact a type of Windows Server), Linux, or anything else - but that' isn’t what you want to manage, monitor, maintain or license. You don’t want to deploy an operating system - you want to deploy an application. You want your code to run, and you don’t care how it does that.

Another benefit to PaaS is that you can ask for hundreds or thousands of new nodes of computing power - there’s no provisioning, it just happens. And you can stop using them quicker - and the base code for your application does not have to change to make this happen.

Windows Azure Roles and Their Use

If you need your code to have a user interface, in Visual Studio you add a Web Role to your project, and if the code needs to do work that doesn’t involve a user interface you can add a Worker Role. They are just containers that act a certain way. I’ll provide more detail on those later.

Note: That’s a general description, so it’s not entirely accurate, but it’s accurate enough for this discussion.

So now we’re back to that VM Role. Because of the name, some have mistakenly thought that you can take a Virtual Machine running, say Linux, and deploy it to Windows Azure using this Role. But you can’t. That’s not what it is designed for at all. If you do need that kind of deployment, you should look into Hyper-V and System Center to create the Private or Public Infrastructure as a Service. What the VM Role is actually designed to do is to allow you to have a great deal of control over the system where your code will run. Let’s take an example.

You’ve heard about Windows Azure, and Platform programming. You’re convinced it’s the right way to code. But you have a lot of things you’ve written in another way at your company. Re-writing all of your code to take advantage of Windows Azure will take a long time. Or perhaps you have a certain version of Apache Web Server that you need for your code to work. In both cases, you think you can (or already have) code the the software to be “Stateless”, you just need more control over the place where the code runs. That’s the place where a VM Role makes sense.


Virtualizing servers alone has limitations of scale, availability and recovery. Microsoft’s offering in this area is Hyper-V and System Center, not the VM Role. The VM Role is still used for running Stateless code, just like the Web and Worker Roles, with the exception that it allows you more control over the environment of where that code runs.

Comments (7)
  1. Brent Ozar says:

    "…some have mistakenly thought that you can take a Virtual Machine running, say Linux, and deploy it to Windows Azure using this Role. But you can’t."

    So are you saying you can take a Virtual Machine running Windows and deploy it to Windows Azure using this role?  I'm saying no, and I just want to make sure we're on the same page.

    "The VM Role is still used for running Stateless code, just like the Web and Worker Roles, with the exception that it allows you more control over the environment of where that code runs."

    I agree, but only if you add in five crucial words.  The sentence needs to read, "more control over the environment of where that code runs THAN AZURE WEB ROLES ALLOW."  Otherwise, it implies that you get more control in Azure VM roles than you do in any other stateless code deployment tool, and that's simply not the case with Hyper-V or VMware.  You get much more control over the environment's hardware, software, and patching with on-prem virtualization.

  2. Gavin Payne says:

    I think you're article shares Microsoft's intention which was to create a slightly more flexible PaaS platform for running non-Azure friendly apps by presenting a Windows environment in the cloud.

    Sadly there is a perception from those who don't subscribe to that understanding that Azure's VM-role is just pure IaaS, driven by the fact you build your own VHD then upload it, which makes people compare it to other providers such as AWS who have products far more optimised for bespoke content VM hosting.

    Maybe its the name of the product or there's VHD uploading which confuses people, I'm not sure yet.

  3. Buck Woody says:

    Brent – you are correct, if not in the strictes sense. If you take any old VHD and deploy it, it won't work. There are very specific steps, versions, and processes for it. If, however, you follow all of the restrictions and steps, then you can.

    And you're correct in that designation. If you were to recreate the Azure idea in Hyper-V, you could most certainly have the same or better control. But now you're also responsible for designing the scale and HA – which we did for you alread in – wiat for it – Windows Azure. :)

    Thanks for the comments, my friend. See you soon.

  4. Buck Woody says:

    Gavin – it's the name. It was actually the object of some debate, and many people – lots of them – still confuse VM Role with IaaS for the name reason alone. Very unfortunate, in my humble opinion.

    The key is this: Windows Azure == Opening Visual Studio (or Eclipse) and writing code. End of story. If you're not opening code, you're talking Hyper-V. Does that make sense?

  5. Gavin Payne says:

    Makes sense, I buy into the concept, I just think whenever you present someone with a Windows desktop in the cloud people are going to think they can deploy and install anything they want, how they want.

  6. BuckWoody says:

    Gavin – agreed. We do in fact offer that – in Hyper-V with System Center.

    It's kind of like the fact we offer an editor in Outlook – but that's not a Microsoft Word competitor.

  7. achilles says:

    According to Microsoft's plans, Windows Azure will be available later this year, another called VM Role of the computing services that will allow the user to the underlying computing platform with more control, through Remote Desktop Services (RDS) connected In the past. Its main purpose is to existing Windows applications can be relatively smooth migration to Windows Azure up.

Comments are closed.

Skip to main content