Create an Azure Virtual Machine

This guide will walk you through the process of creating a virtual machine (VM) in Microsoft Azure. Azure VMs provide on-demand, scalable computing resources. You can use VMs to host applications, run complex software, and much more.

Prerequisites

  • An Azure subscription. If you don't have one, create a free account.
  • Permissions to create resources within your subscription.

Steps to Create a VM

You can create an Azure VM using the Azure portal, Azure CLI, Azure PowerShell, or ARM templates. This guide focuses on the Azure portal for simplicity.

1. Sign in to the Azure portal

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

2. Navigate to Virtual Machines

In the Azure portal search bar at the top, type "Virtual machines" and select "Virtual machines" from the services list.

3. Initiate VM Creation

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

4. Configure Basic Settings

On the Create a virtual machine blade, you'll configure several essential settings:

  • Subscription: Select your Azure subscription.
  • Resource group: Choose an existing resource group or 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., my-azure-vm).
  • Region: Select an Azure region geographically close to you or your users.
  • Availability options: For production workloads, consider availability sets or zones. For this basic setup, "No infrastructure redundancy required" is sufficient.
  • Security type: Standard is usually fine for most use cases.
  • Image: Select an operating system image. Common choices include Windows Server, Ubuntu Server, and Red Hat Enterprise Linux.
  • Size: Choose a VM size that meets your performance and cost requirements. Azure offers a wide range of sizes (e.g., B-series for burstable, D-series for general purpose, E-series for memory-optimized).
  • Administrator account:
    • Authentication type: For Linux, choose SSH public key or Password. For Windows, it's Password.
    • Username: Create an administrator username.
    • Password / SSH public key: Provide the necessary credentials. Ensure you use a strong password.
  • Inbound port rules:
    • Public inbound ports: Select "Allow selected ports".
    • Select inbound ports: For a web server, you'll typically want to allow RDP (3389) for Windows or SSH (22) for Linux, and HTTP (80) / HTTPS (443) if you plan to host web applications.

Once the basic settings are configured, click Next: Disks >.

5. Configure Disks

Choose the OS disk type (e.g., Premium SSD, Standard SSD, Standard HDD) and configure any additional data disks you might need.

Click Next: Networking >.

6. Configure Networking

Configure the virtual network, subnet, public IP address, and Network Security Group (NSG). The default settings are often sufficient for basic VM creation.

Click Next: Management >.

7. Configure Management Options

Review and configure monitoring, identity, and auto-shutdown settings as needed.

Click Next: Advanced >.

8. Configure Advanced Settings (Optional)

This section allows for more advanced configurations like extensions, custom data, and host group management.

Click Next: Tags >.

9. Add Tags (Optional)

Tags are key-value pairs that help you organize your Azure resources. For example, you might use a tag like Environment: Development.

Click Next: Review + create >.

10. Review and Create

Azure will validate your configuration. Review the summary of your VM settings. If everything looks correct, click the Create button.

The deployment process typically takes a few minutes. You can monitor the deployment progress in the Azure portal.

11. Connect to Your VM

Once the deployment is complete, navigate back to the "Virtual machines" service and select your newly created VM. You will find the public IP address on the VM's overview page, which you can use to connect using RDP (for Windows) or SSH (for Linux).

For example, to connect via SSH from a Linux or macOS terminal:

ssh <username>@<public_ip_address>

And for RDP on Windows, you would use the public IP address with your Remote Desktop Connection client.

Next Steps

Try Azure for Free