Azure VM Basics Tutorial

Introduction to Azure Virtual Machines

This tutorial guides you through the fundamental concepts and steps involved in creating and managing your first Azure Virtual Machine (VM). Azure VMs provide on-demand, scalable computing resources in the cloud, allowing you to run applications and services without needing to manage physical hardware.

What You Will Learn

Prerequisites

Before you begin, you'll need:

Step 1: Creating Your First Azure VM

We will use the Azure portal to create a virtual machine. Follow these steps:

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, type "Virtual machines" and select it from the results. Alternatively, click the menu icon in the top left and select "Virtual machines".

3

Create a Virtual Machine

Click the "+ Create" button and then select "Virtual machine".

Azure portal create VM button
4

Configure Basic Settings

You'll be presented with several tabs for configuration. Start with the "Basics" tab:

  • Subscription: Select your Azure subscription.
  • Resource group: Create a new one (e.g., `my-vm-rg`) or select an existing one. Resource groups help organize your Azure resources.
  • Virtual machine name: Give your VM a unique name (e.g., `my-first-vm`).
  • Region: Choose a region geographically close to you or your users for better performance.
  • Availability options: For this basic tutorial, you can leave this as default.
  • Security type: Standard is suitable for basic testing.
  • Image: Select an operating system. For this example, let's choose "Windows Server 2022 Datacenter: Azure Edition" or "Ubuntu Server 22.04 LTS".
  • Size: Choose a VM size that fits your needs and budget. For testing, `Standard_B1ms` or `Standard_D2s_v3` are good starting points.
  • Administrator account:
    • Username: Create a username (e.g., `azureuser`).
    • Password: Set a strong password or use SSH public key (for Linux).
  • Inbound port rules:
    • For Windows, allow RDP (port 3389) to connect remotely.
    • For Linux, allow SSH (port 22) to connect remotely.
Azure VM basics configuration
Tip: For Windows VMs, RDP (Remote Desktop Protocol) allows graphical remote access. For Linux VMs, SSH (Secure Shell) is the standard for command-line access.
5

Configure Disks, Networking, and Management (Optional for Basics)

You can explore the other tabs (Disks, Networking, Management, Advanced, Tags) to customize further. For this tutorial, the default settings on these tabs are usually sufficient.

  • Disks: Determines the type and size of storage for your VM.
  • Networking: Configures virtual networks, subnets, and public IP addresses.
  • Management: Enables monitoring, auto-shutdown, and other management features.
6

Review and Create

Click on the "Review + create" button. Azure will validate your configuration. Once validation passes, click "Create" to begin the deployment. Deployment typically takes a few minutes.

Azure VM review and create screen

Step 2: Connecting to Your VM

Once your VM deployment is complete, you can connect to it.

1

Find Your VM's IP Address

Navigate back to your Virtual Machines list in the Azure portal. Click on your newly created VM. On the VM's overview page, you will find its Public IP address.

Azure VM public IP address
2

Connect via RDP (Windows)

  1. Open the Remote Desktop Connection application on your local computer.
  2. Enter the Public IP address of your Azure VM and click "Connect".
  3. When prompted, enter the username and password you created during VM setup.
3

Connect via SSH (Linux)

Open a terminal or command prompt on your local computer. Use the following command, replacing <your-username> and <public-ip-address>:

ssh <your-username>@<public-ip-address>

If you are using SSH keys, you may need to specify the path to your private key:

ssh -i /path/to/your/private/key <your-username>@<public-ip-address>

You will be prompted to confirm the connection fingerprint and enter your password or passphrase if your key is protected.

Step 3: Basic VM Management

Azure provides powerful tools for managing your VMs:

Common Management Tasks

Note: Remember to stop (deallocate) your VM when you are not actively using it to avoid unnecessary charges.

Conclusion

Congratulations! You have successfully created and connected to your first Azure Virtual Machine. This tutorial covered the basics, but Azure offers a vast array of services for networking, storage, security, and more to build sophisticated cloud solutions.

Next Steps