Microsoft Docs

Create an Azure Virtual Machine

This guide walks you through the process of creating a new virtual machine (VM) in Azure using the Azure portal. Azure VMs provide on-demand, scalable computing resources. You can choose from a wide variety of operating systems and configurations to meet your workload requirements.

Prerequisites

Steps to Create a VM

  1. 1

    Sign in to the Azure portal

    Open your web browser and go to https://portal.azure.com/. Sign in with your Azure account credentials.

  2. 2

    Navigate to Virtual machines

    In the Azure portal, search for "Virtual machines" in the top search bar and select "Virtual machines" from the results.

    Alternatively, you can click the menu icon (three horizontal lines) in the top-left corner, then select "Virtual machines".

  3. 3

    Create a new virtual machine

    On the Virtual machines page, click the + Create button and select Virtual machine.

    Note: You can also create VMs using Azure CLI, PowerShell, ARM templates, or other tools. This guide focuses on the Azure portal.
  4. 4

    Configure Basics

    On the "Create a virtual machine" page, go to the Basics tab:

    • Subscription: Select the Azure subscription to use.
    • Resource group: Choose an existing resource group or click "Create new" to create a new one. A resource group is a logical container for your Azure resources.
    • Virtual machine name: Enter a unique name for your VM.
    • Region: Select the Azure region where you want to deploy your VM. Choose a region close to your users or other Azure resources for better performance.
    • Availability options: Configure availability sets or zones for high availability (optional).
    • Security type: Choose the desired security level. Standard is common for most use cases.
    • Image: Select an operating system image for your VM. You can choose from popular Linux distributions (like Ubuntu, CentOS, Red Hat) or Windows Server versions.
    • VM architecture: Select x64 or Arm64 depending on your needs.
    • Size: Choose a VM size that meets your performance and cost requirements. Azure offers a wide range of sizes.
    • Administrator account:
      • For Linux: Choose "SSH public key" or "Password". If using SSH keys, provide your public key.
      • For Windows: Enter a username and password.
    • Inbound port rules: For quick testing, you can allow RDP (3389) for Windows or SSH (22) for Linux from the internet. For production, it's recommended to configure network security groups more restrictively.
    Tip: For Linux VMs, using SSH public key authentication is generally more secure than password authentication.
  5. 5

    Configure Disks

    Navigate to the Disks tab. Here you can configure the OS disk and add data disks:

    • OS disk type: Choose between Premium SSD, Standard SSD, or Standard HDD based on performance and cost.
    • Data disks: Click "Create and attach a new disk" to add additional storage for your applications and data.
  6. 6

    Configure Networking

    Go to the Networking tab. This section allows you to configure network interfaces, virtual networks, subnets, public IPs, and network security groups (NSGs):

    • Virtual network: Select an existing VNet or create a new one.
    • Subnet: Choose or create a subnet within the VNet.
    • Public IP: Decide if you need a public IP address for your VM.
    • NIC network security group: Configure inbound and outbound security rules.
    Important: Properly configuring NSGs is crucial for securing your VM. Restrict access to only necessary ports and IP addresses.
  7. 7

    Configure Management, Advanced, and Tags

    Explore the following tabs for additional configurations:

    • Management: Configure boot diagnostics, OS guest diagnostics, identity, and auto-shutdown.
    • Advanced: Set up extensions, custom data, host, and proximity placement groups.
    • Tags: Apply tags (key-value pairs) for organizing and managing your Azure resources.
  8. 8

    Review and Create

    Click on the Review + create tab. Azure will validate your VM configuration. Once validation passes, review the summary of your VM settings.

    If everything looks correct, click the Create button.

    The deployment process will begin. You can monitor the progress in the Azure portal.

  9. 9

    Connect to your VM

    Once the deployment is complete, navigate to your VM's overview page. You will find connection information, including the public IP address.

    For Windows VMs, use Remote Desktop Connection (RDP) with the administrator credentials you set.

    For Linux VMs, use an SSH client (like PuTTY or the command-line `ssh`) with your SSH key or password.

    ssh your_username@your_vm_public_ip_address

Next Steps