Share via


Introduction to the VM Role Development Process

[This topic provides preliminary content for the beta release of the Windows Azure VM role feature. To join the beta, log on to the Management Portal, click Home, and then click Beta Programs.]

The Windows Azure virtual machine (VM) role enables you to deploy a custom Windows Server 2008 R2 image to Windows Azure. With a VM role, you can work in a familiar environment, using standard Windows technologies to create an image, install your software to it, prepare it for deployment to Windows Azure, and manage it once it has been deployed. The Windows Azure VM role is designed for compatibility with ordinary Windows Server workloads, making it an ideal option for migrating existing applications to Windows Azure.

When you deploy a VM role to Windows Azure, you are running an instance of Windows Server 2008 R2 in Windows Azure. A VM role gives you a high degree of control over the virtual machine, while also providing the advantages of running within the Windows Azure environment: immediate scalability, in-place upgrades with no service downtime, integration with other components of your service, and load-balanced traffic.

Note

Windows Server 2008 R2 is the only supported operating system for a VM role.

Note also that a server instance running in Windows Azure is subject to certain limitations that an on-premises installation of Windows is not. Some network-related functionality is restricted; for example, in order to use the UDP protocol, you must also use Windows Azure Connect. Additionally, a server instance running in Windows Azure does not persist state. If the server instance is re-created from the image, either because the operator requested a reimage or because Windows Azure needed to move the server instance to different hardware, any state associated with that instance that has not been persisted to a durable storage medium outside of the virtual machine is lost.

It's recommended that you use the Windows Azure storage services to persist state, either by writing it to a blob or to a Windows Azure drive. Data that is written to the local storage resource directory is persisted when a server instance is reimaged; however, this data may be lost in the event of a transient failure in Windows Azure that requires your server instance to be moved to different hardware.

The process of developing and deploying a VM role consists of the following steps:

  • Preparing your image and uploading it to the Windows Azure image repository associated with your subscripton.

  • Designing your service model and preparing your service package.

  • Uploading any certificates to the certificate store.

  • Deploying your service to Windows Azure.

The following image provides an overview of the steps involved, and the subsequent sections provide additional information on each step:

VMRoleOverview

Preparing Your Customized Image

You can use standard Windows image creation technologies to create your custom Windows Server 2008 R2 image. The process of creating your custom image and preparing it for deployment is described in Getting Started with Developing a Server Image for a VM Role. Step-by-step instructions are available in How to: Update the Server Image. You may also wish to consult the documentation for the Windows Automated Install Kit (Windows AIK) for a more thorough explanation of the process of creating a Windows image.

Installing the Windows Azure Integration Components

As part of preparing your Windows Server image on-premises, you must install the Windows Azure Integration Components onto the image. For information on installing the Integration Components onto your image, see How to Install the Windows Azure Integration Components. Once the image has been deployed to Windows Azure as a server instance, the Windows Azure Integration Components handle integrating the server instance with the Windows Azure environment.

Installing Software Applications

As part of the process of preparing your image, you must install any software applications that you want to run on your server instances.

To prepare your image, you will run the System Preparation (Sysprep) tool; Sysprep is also used to setup your server instances once you have deployed your image to Windows Azure. Consult your software application's documentation for information about its compatibility with Sysprep.

Develop the Adapter

When you develop and deploy a custom image, you are installing and configuring software applications to run in the dynamic environment of Windows Azure. In many cases, you may need to provide configuration information for your application that is not available at development time, and must be gathered at runtime. The recommended way to configure your applications for the dynamic environment is by writing an adapter that interacts with Windows Azure and prepares and runs your application. For details on developing an adaptor, see Developing the VM Role Adapter.

Configure the Firewall

As part of the process of preparing your image, you should configure the Windows firewall to open any ports that your application needs once it is running on your server instance in Windows Azure.

It's recommended that your service use well-known ports. You can specify port numbers for endpoints that you define for any role – web, worker, or virtual machine. See (xref) for more information on specifying ports in your service definition.

You can configure the firewall in any of the following ways:

  • Manually, during the process of preparing your image.

  • By using the Windows Firewall API to open a port programmatically.

  • By using the Windows Installer XML (WiX) toolset. If you are writing an installer to install software to your server instance, you can use WiX to open a port in the firewall when the installer runs.

Generalize the Image for Deployment

After you have installed the Windows Azure Integration Components, your software, and your adapter and configured the firewall, you need to generalize your image for deployment to Windows Azure by running Sysprep. The process of generalization strips out information that is specific to the current running instance of Windows, so that the image may be deployed to one or more virtual machine in Windows Azure. For more information on using Sysprep to generalize your image, see How to Prepare the Image for Deployment. For technical details on Sysprep, see the Sysprep Technical Reference.

During the process of preparing your image for deployment, you may generalize and then specialize it several times, in an iterative process. Each time you create a virtual machine from the image, Windows Setup runs and performs specialization functions for that machine. Your final task before you upload your image to the Windows Azure image repository is to generalize the image.

The specialization pass happens again once your image is deployed to Windows Azure. Each server instance that is created from your image runs an automated Windows setup process using Sysprep. The automated specialization pass uses configuration values from the answer file that is installed to the image's root directory by the Windows Azure Integration Components. For more information, see About the Windows Azure Integration Components.

For information on uploading your image to Windows Azure, see How to Upload a VHD to Windows Azure.

Designing Your Service Model

Your service definition and service configuration files define your VM role and specify the image to use for it; specify where any certificates should be installed; and specify the number of server instances to create. For details on creating your service model and deploying your service package, see Creating the Service Model and Deploying the Package.

Uploading Certificates to the Windows Azure Certificate Store

Any certificates required by your VM role should be installed to the Windows Azure certificate store; you should not include them with your image, as Sysprep strips out private key information. For more information on installing certificates to your server instances, see About the Windows Azure Integration Components.

For general information on working with service certificates in Windows Azure, see Managing Service Certificates.

Deploying Your Service to Windows Azure

Once you have uploaded your image, your service model and service package, and any service certificates to Windows Azure, you can deploy your service to Windows Azure. When you deploy your service, Windows Azure creates virtual machines for each of your server instances and boots Windows. After Windows setup completes, your server instances are brought online and begin receiving traffic from the load balancer. For more details, see About the VM Role Deployment Lifecycle.

See Also

Concepts

About the VM Role Deployment Lifecycle
About the Windows Azure Integration Components
Understanding Service Readiness and Maintaining Service-Level Agreement
Developing the VM Role Adapter
Testing a VM Role