Quickstart: Create a Windows virtual machine in the Azure portal

Azure virtual machines (VMs) can be created through the Azure portal. This method provides a browser-based user interface to create VMs and their associated resources. This quickstart shows you how to use the Azure portal to deploy a virtual machine (VM) in Azure that runs Windows Server 2016. To see your VM in action, you then RDP to the VM and install the IIS web server.

If you don't have an Azure subscription, create a free account before you begin.

Log in to Azure

Log in to the Azure portal at https://portal.azure.com.

Create virtual machine

  1. Choose Create a resource in the upper left-hand corner of the Azure portal.

  2. In the search box above the list of Azure Marketplace resources, search for and select Windows Server 2016 Datacenter, then choose Create.

  3. Provide a VM name, such as myVM, leave the disk type as SSD, then provide a username, such as azureuser. The password must be at least 12 characters long and meet the defined complexity requirements.

    Enter basic information about your VM in the portal blade

  4. Choose to Create new resource group, then provide a name, such as myResourceGroup. Choose your desired Location, then select OK.

  5. Select a size for the VM. You can filter by Compute type or Disk type, for example. A suggested VM size is D2s_v3.

    Screenshot that shows VM sizes

  6. Under Settings, leave the defaults and select OK.

  7. On the summary page, select Create to start the VM deployment.

  8. The VM is pinned to the Azure portal dashboard. Once the deployment has completed, the VM summary automatically opens.

Connect to virtual machine

Create a remote desktop connection to the virtual machine. These directions tell you how to connect to your VM from a Windows computer. On a Mac, you need an RDP client such as this Remote Desktop Client from the Mac App Store.

  1. Click the Connect button on the virtual machine properties page.

    Connect to an Azure VM from the portal

  2. In the Connect to virtual machine page, keep the default options to connect by DNS name over port 3389 and click Download RDP file.

  3. Open the downloaded RDP file and click Connect when prompted.

  4. In the Windows Security window, select More choices and then Use a different account. Type the username as vmname*username, enter password you created for the for the virtual machine, and then click **OK*.

  5. You may receive a certificate warning during the sign-in process. Click Yes or Continue to proceed with the connection.

Install web server

To see your VM in action, install the IIS web server. Open a PowerShell prompt on the VM and run the following command:

Install-WindowsFeature -name Web-Server -IncludeManagementTools

When done, close the RDP connection to the VM.

Open port 80 for web traffic

A Network Security Group (NSG) secures inbound and outbound traffic. When a VM is created from the Azure portal, an inbound rule is created on port 3389 for RDP connections. Because this VM hosts a web server, an NSG rule needs to be created for port 80.

  1. On the VM overview page, select Networking.
  2. The list of existing inbound and outbound rules are shown. Choose to Add inbound port rule.
  3. Select the Basic option across the top, then choose HTTP from the list of available services. Port 80, a priority, and name, are provided for you.
  4. To create the rule, select Add.

View the IIS welcome page

With IIS installed and port 80 now open on your VM from the Internet, use a web browser of your choice to view the default IIS welcome page. Use the public IP address of your VM obtained in a previous step. The following example shows the default IIS web site:

IIS default site

Clean up resources

When no longer needed, you can delete the resource group, virtual machine, and all related resources. To do so, select the resource group for the virtual machine, select Delete, then confirm the name of the resource group to delete.

Next steps

In this quickstart, you deployed a simple virtual machine, open a network port for web traffic, and installed a basic web server. To learn more about Azure virtual machines, continue to the tutorial for Windows VMs.