Create a Virtual Machine Running Windows
This tutorial shows you how easy it is to create an Azure virtual machine (VM). It uses a Windows Server image, but that's only one of the many images available through Azure. This includes Windows operating systems, Linux-based operating systems, and images with pre-installed applications. The images you can choose from depend on the type of subscription you have. For example, desktop images may be available to MSDN subscribers.
You don't need any experience with Azure VMs to finish this tutorial, but you do need an Azure account. You can create a free trial account in just a couple of minutes. For details, see Create an Azure account.
This tutorial shows you:
If you'd like to know more, see Virtual Machines.
How to create the virtual machine
This section shows you how to use the From Gallery option in the Management Portal to create the virtual machine. This option provides more configuration choices than the Quick Create option. For example, if you want to join a virtual machine to a virtual network, you'll need to use the From Gallery option.
You can also try the richer, customizable Azure Preview Portal to create a virtual machine, automate the deployment of multi-VM application templates, use enhanced VM monitoring and diagnostics features, and more. The available VM configuration options in the two portals overlap substantially but aren't identical.
Sign in to the Azure Management Portal. Check out the Free Trial offer if you don't have a subscription yet.
On the command bar at the bottom of the window, click New.
Under Compute, click Virtual Machine, and then click From Gallery.
The first screen lets you Choose an Image for your virtual machine from one of the lists in the Image Gallery. (The available images may differ depending on the subscription you're using.) Click the arrow to continue.
The second screen lets you pick a computer name, size, and administrative user name and password. If you just want to try out Azure Virtual Machines, fill in the fields as shown in the image below. Otherwise, chose the tier and size required to run your app or workload. Here are some details to help you fill this out:
- New User Name refers to the administrative account that you use to manage the server. Create a unique password for this account and make sure to remember it. You'll need the user name and password to log on to the virtual machine.
- A virtual machine's size affects the cost of using it, as well as configuration options such as the number of data disks you can attach. For details, see Virtual Machine and Cloud Service Sizes for Azure.
The third screen lets you configure resources for networking, storage, and availability. Here are some details to help you fill this out:
- The Cloud Service DNS Name is the global DNS name that becomes part of the URI that's used to contact the virtual machine. You'll need to come up with your own cloud service name because it must be unique in Azure. Cloud services are important for scenarios using multiple virtual machines.
- For Region/Affinity Group/Virtual Network, use a region that's appropriate to your location. You can also choose to specify a virtual network instead.
The fourth configuration screen lets you configure the VM Agent and some of the available extensions. Click the check mark to create the virtual machine.
The VM agent provides the environment for you to install extensions that can help you interact with or manage the virtual machine. For details, see Using Extensions.
After the virtual machine is created, the Management Portal lists the new virtual machine under Virtual Machines. The corresponding cloud service and storage account also are created and are listed in those sections. Both the virtual machine and cloud service are started automatically and the Management Portal shows their status as Running.
How to log on to the virtual machine after you create it
This section shows you how to log on to the virtual machine so you can manage its settings and the applications that you'll run on it.
If you haven't already done so, sign in to the Azure Management Portal.
Click Virtual Machines, and then select the appropriate virtual machine.
On the command bar, click Connect.
Click Open to use the Remote Desktop Protocol file that's automatically created for the virtual machine.
Click Connect to continue.
Type the credentials for the administrative account on the virtual machine, and then click OK.
In most cases, you'll use the user name and password that was specified when the virtual machine was created. Check the user name to make sure it has the correct domain information:
- If the VM belongs to a domain at your organization, make sure the user name includes the name of that domain.
- If the VM doesn't belong to a domain, either remove any domain information by starting the line with '\' or use the VM name as the domain name. For example,
- If the VM is a domain controller, type the user name and password of a domain administrator account for that domain.
Click Yes to verify the identity of the virtual machine.
You can now work with the virtual machine remotely.
How to attach a data disk to the new virtual machine
This section shows you how to attach an empty data disk to the virtual machine. See the Attach a Data Disk Tutorial for more information, including how to attach existing disks.
Sign in to the Azure Management Portal.
Click Virtual Machines, and then select the MyTestVM virtual machine.
You may see the Quick Start page first. If so, select Dashboard from the top.
On the command bar, click Attach, and then click Attach Empty Disk when it pops up.
The Virtual Machine Name, Storage Location, File Name, and Host Cache Preference are already defined for you. All you have to specify is a size for the disk. For example, type 5 in the Size field. Click the check mark to attach the disk.
All disks are created from .vhd files in Azure storage. File Name lets you name the .vhd file that the disk uses, not the disk name. Azure automatically assigns a name to the disk.
The .vhd files are stored as page blobs in Azure storage. Outside of Azure, virtual hard disks can use either a VHD or a VHDX format. They can also be fixed, dynamically expanding, or differencing. Azure supports VHD format, fixed disks. For more details, see About VHDs in Azure
Return to the dashboard to verify that the empty data disk was successfully attached to the virtual machine. It should appear in the Disks list after the OS Disk.
When you attach a data disk, it's offline and not initialized. Before you can use it to store data, you'll need to log on to the virtual machine and initialize the disk.
Connect and log on to the virtual machine by using the steps in the previous section, How to log on to the virtual machine after you create it.
After you log on to the virtual machine, open Server Manager. In the left pane, select File and Storage Services.
Select Disks from the expanded menu.
The Disks section lists disk 0, disk 1, and disk 2. Disk 0 is the OS disk, disk 1 is a temporary resource disk (which should not be used for data storage), and disk 2 is the data disk you have attached to the virtual machine. The data disk has a capacity of 5 GB, based on what you specified when you attached the disk. Right-click disk 2 and select Initialize.
Right-click disk 2 again and select New Volume.
Complete the wizard using the default values. When the wizard is done, the Volumes section lists the new volume. The disk is now online and ready to store data.
To learn more about configuring Windows virtual machines on Azure, see:
How to Connect Virtual Machines in a Cloud Service
How to Create and Upload your own Virtual Hard Disk containing the Windows Server Operating System
Manage the Availability of Virtual Machines
About Azure VM configuration settings
VIDEO: Getting Started with VHDs - What's Really Happening
VIDEO: FAQ with Mark Russinovich - Does Windows Azure run Windows?
VIDEO: Adding a new virtual machine to a Web Farm by making reusable images
VIDEO: Adding Virtual Hard Drives, Storage Accounts, and Scaling Virtual Machines
VIDEO: Scott Guthrie starts with Virtual Machines
VIDEO: Storage and Disk Basics with Azure Virtual Machines