Microsoft Docs

Azure Documentation | Tutorials

Create a Windows Virtual Machine in Azure

This tutorial guides you through the process of creating a Windows virtual machine (VM) in Azure using the Azure portal. Azure Virtual Machines give you the flexibility of virtualization without having to buy and maintain the physical hardware that runs it.

Note: This tutorial uses the Azure portal. You can also create VMs using Azure CLI, Azure PowerShell, or ARM templates.

Prerequisites

Steps to Create a Windows VM

Step 1: Sign in to the Azure Portal

Open your web browser and navigate to the Azure portal. Sign in with your Azure account credentials.

Azure Portal Login Screen

Step 2: Create a Virtual Machine Resource

  1. In the Azure portal search bar, type "Virtual machines" and select it from the results.
  2. Click on the + Create button and select Virtual machine.
Azure Create VM Button

Step 3: Configure Basic Settings

On the Create a virtual machine page, under the Basics tab, configure the following settings:

  • Subscription: Select your Azure subscription.
  • Resource group: Choose an existing resource group or click Create new to create a new one. A resource group is a logical container for Azure resources.
  • Virtual machine name: Enter a unique name for your VM (e.g., myWindowsVM).
  • Region: Select the Azure region where you want to deploy your VM. Choose a region close to your location or your users for better performance.
  • Availability options: For this tutorial, you can leave this as No infrastructure redundancy required.
  • Security type: Select Standard.
  • Image: Click the dropdown and select a Windows Server image. For example, Windows Server 2022 Datacenter: Azure Edition - Gen2.
  • Size: Click See all sizes to choose a VM size that suits your needs. For a basic test VM, a smaller size like Standard_B1s or Standard_D2s_v3 might be sufficient.
  • Administrator account:
    • Username: Enter a username for the local administrator account (e.g., azureuser).
    • Password: Enter a strong password.
    • Confirm password: Re-enter the password.
  • Inbound port rules:
    • Public inbound ports: Select Allow selected ports.
    • Select inbound ports: Choose RDP (3389). This allows you to connect to the VM remotely.
VM Basics Configuration

Step 4: Configure Disks

Under the Disks tab, you can configure the operating system disk and any data disks.

  • OS disk type: Choose between Premium SSD, Standard SSD, or Standard HDD. Premium SSDs offer the best performance.
  • You can add data disks if needed by clicking Create and attach a new disk. For this tutorial, the default OS disk is usually sufficient.
VM Disks Configuration

Step 5: Configure Networking

Under the Networking tab, you can configure network settings.

  • Virtual network: A new virtual network will be created by default, or you can select an existing one.
  • Subnet: A subnet within the virtual network will be created.
  • Public IP: A new public IP address will be created to allow access from the internet.
  • NIC network security group: Select Basic.
  • Public inbound ports: Ensure Allow selected ports is chosen and RDP (3389) is selected.
VM Networking Configuration

Step 6: Review and Create

Go through the remaining tabs (Management, Advanced, Tags) if you need to configure more advanced settings. For this tutorial, you can skip them.

Click on the Review + create button.

Azure will validate your configuration. Once validation passes, review the deployment summary and click Create.

Azure Review and Create Button

Step 7: Connect to Your VM

Once the deployment is complete (this may take a few minutes), navigate to the virtual machine resource. You will see its overview page.

Click the Connect button and choose RDP.

Download the RDP file and open it. Connect using the administrator username and password you created earlier.

Azure Connect to VM RDP

Important: For production environments, consider using more secure methods for connectivity, such as Azure Bastion or a VPN gateway, and configure Network Security Group rules to restrict RDP access to only trusted IP addresses.

Next Steps