Updated: April 16, 2013
Windows Azure Virtual Machine enables you to create a server in the cloud that you can control and manage. After you create a virtual machine in Windows Azure, you can access it like any other server and you can delete and re-create it whenever you need to. You can use a virtual machine in Windows Azure to deploy available versions of Windows Server or distributions of Linux operating systems. The virtual hard disk (VHD) that you deploy in a virtual machine can contain customized settings and your applications. Thus, the virtual machine provides a robust platform for developing or migrating your application solutions. You can create multiple virtual machines and then load balance traffic between them. You can also connect virtual machines to other Windows Azure cloud services running web roles and worker roles.
This topic covers fundamental concepts of virtual machines in Windows Azure. You might prefer to immediately proceed to any of the following quick-start topics.
Runway to the cloud for existing applications – A virtual machine in Windows Azure stores operating system data. You can also attach a data disk to a virtual machine for storing application data. These features enable you to easily migrate your applications to Windows Azure as-is, without requiring any changes to the existing code.
Storage of operating system data – Changes that you make to the configuration of the operating system are preserved in Windows Azure Storage for high durability of data.
Single instance availability – In Windows Azure, operating system data for a virtual machine is stored for you, which means that customization of the virtual machine only applies to one running instance.
Full control of the operating system – As an administrator, you can remotely access the virtual machine to perform maintenance and troubleshooting tasks.
Whether you create virtual machines using the management portal, Windows Azure cmdlets, or the API, the building blocks are the same. Building blocks include images, operating system disks, and storage disks.
An image is a VHD that you use as a template to create a new virtual machine. An image is a template because, unlike a running virtual machine, it doesn’t have specific settings such as the computer name and user account settings. When you create a virtual machine from an image, an operating system disk is automatically created for the new virtual machine.
You can either use an image provided by Windows Azure in the Image Gallery, or you can create your own image to use as a template. For example, you can create a virtual machine from an image in the Image Gallery. Windows Azure provides a selection of Windows and Linux images ready to go. You can also make your own images -- changing the operating system in a virtual machine and then capturing it to be used as an image for new virtual machines. For more information about capturing images, see How to Capture an Image of a Virtual Machine Running Windows Server or How to Capture an Image of a Virtual Machine Running Linux
For more information about using images, see Manage Disks and Images.
An operating system disk is a VHD that you can boot and mount as a running version of an operating system. Any VHD that is attached to virtualized hardware and that is running as part of a service is an operating system disk. After an image is provisioned, it becomes an operating system disk. An operating system disk is always created when you use an image to create a virtual machine.
The VHD that is intended to be used as an operating system disk contains the operating system, any operating system customizations, and your applications. If you’re new to virtualization, the following resources can help you learn more about VHDs and server images:
Sysprep Technical Reference
Windows Automated Installation Kit for Windows 7
Appendix: Tools and APIs for Virtual Hard Disks
Sources of New Virtual Machines
For more information about using operating system disks, see Manage Disks and Images.
A VHD can also be used as a data disk to enable a virtual machine to store application data. After you create a virtual machine, you can either attach an existing data disk to the machine, or you can create and attach a new data disk. Whenever you use a data-intensive application in a virtual machine, it’s highly recommended that you use a data disk to store application data, rather than using the operating system disk.
For more information about attaching data disks to a virtual machine, see How to Attach a Data Disk to a Virtual Machine
Each VHD also has a temporary storage disk, which is labeled as drive D. The applications and processes running in the VM can use this disk for transient and temporary storage.
|The virtual machine operating system disk and data disks have a host caching setting (sometimes called host-cache mode) that may improve performance under some circumstances. However, these settings can negatively affect performance in other circumstances, depending on the application. Host caching is off by default for both read operations and write operations for data disks. Host-caching is on by default for write operations for operating system disks. To change the setting in data disks, use the Set-AzureDataDisk cmdlet. To change the setting in operating system disks, use the Set-AzureOSDisk cmdlet. For more information about using these cmdlets, see Getting Started with Windows Azure PowerShell.|
For more information about using data disks, see Manage Disks and Images.
When you create a virtual machine, you can choose from various sizes.
For detailed information about the available sizes and options for virtual machines on Windows Azure, see Virtual Machine and Cloud Service Sizes for Windows Azure.
For a virtual machine that is running Windows Server, you use the Connect button in the Management Portal to start a Remote Desktop Connection. For a virtual machine that is running the Linux operating system, you use a Secure Shell (SSH) client to logon. You must install an SSH client on your computer that you want to use to log on to the virtual machine. There are many SSH client programs available. The following are possible choices:
If you are using a computer that is running a Windows operating system, you might want to use an SSH client such as PuTTY. For more information, see the PuTTY Download Page.
If you are using a computer that is running a Linux operating system, you might want to use an SSH client such as OpenSSH. For more information, see OpenSSH.
For more information about logging on to a computer running Windows Server, see How to Log on to a Virtual Machine Running Windows Server 2008 R2. For more information about logging on to a computer running Linux, see How to Log on to a Virtual Machine Running Linux.
All virtual machines that you create in Windows Azure can automatically communicate using a private network channel with other virtual machines in the same cloud service or virtual network. However, you must add an endpoint to a machine for communication with other resources on the Internet or other virtual networks. You can associate specific ports and a protocol to endpoints. Resources can connect to an endpoint by using a protocol of TCP or UDP. The TCP protocol includes HTTP and HTTPS communication.
Each endpoint defined for a virtual machine is assigned a public and private port for communication. The private port is defined for setting up communication rules on the virtual machine. The public port is used by the Windows Azure load balancer to communicate with the virtual machine from external resources.
For more information about setting up endpoints for a virtual machine, see How to Set Up Communication with a Virtual Machine.
All virtual machines that you create in Windows Azure can automatically communicate with other virtual machines in the same cloud service or in the same virtual network. However, you might want to harness the power of multiple virtual machines to handle high-volume requests. To do this, you add an endpoint to a virtual machine, define it as a load-balanced endpoint, and then add other virtual machines to share it. Windows Azure takes the inbound traffic to that endpoint and shares it among the virtual machines.
For more information about connecting virtual machines, see How to Connect Virtual Machines in a Cloud Service
The process for load-balancing virtual machines includes the following steps:
Create a virtual machine. You can use Quick Create or From Gallery to create the machine.
Add an endpoint to the new virtual machine. You assign a protocol, a public port, and a private port to the endpoint. The protocols that can be used for an endpoint are TCP and UDP. The TCP protocol also covers HTTP communication.
Create another virtual machine using From Gallery and choose to connect the new virtual machine to the virtual machine that you previously created. Virtual machines must be connected together under a cloud service to share a load-balanced endpoint.
Create an endpoint on the second virtual machine and choose to make it a load-balanced endpoint by selecting the endpoint that you created on the first virtual machine.
Load balancing virtual machines is closely related to ensuring the availability of your application. For more information, see Manage the availability of virtual machines.