Azure Virtual Machines (VMs)

Azure Virtual Machines provide on-demand, scalable computing resources. You can use VMs to deploy and run applications that include virtualized servers, storage, and networking. Azure offers a wide variety of VM configurations to meet your performance, memory, and storage needs.

Key Concepts

VM Sizes

Azure offers a broad range of VM sizes optimized for different workloads. These sizes are grouped into families such as:

Images

You can deploy VMs from a variety of operating system images, including:

Disks

Azure VMs use virtual hard disks (VHDs) to store operating systems, applications, and data. There are two main types of disks:

Disk types include:

Common Operations

Creating a VM

You can create an Azure VM using the Azure portal, Azure CLI, Azure PowerShell, or ARM templates.

Example using Azure CLI:

az vm create \
  --resource-group MyResourceGroup \
  --name MyVM \
  --image UbuntuLTS \
  --admin-username azureuser \
  --admin-password 'MyComplexPassword!123' \
  --size Standard_DS1_v2 \
  --location eastus

Connecting to a VM

For Windows VMs: Use Remote Desktop Protocol (RDP). Connect to the VM's public IP address.

For Linux VMs: Use SSH. Connect to the VM's public IP address on port 22.

ssh azureuser@<public_ip_address>

Managing VM State

You can start, stop, deallocate, and restart VMs to manage costs and resources.

Networking for VMs

VMs are typically deployed within an Azure Virtual Network (VNet). Network Security Groups (NSGs) are used to control inbound and outbound network traffic to VM network interfaces, subnets, and network interfaces.

Best Practices

Tip: Utilize Azure Spot Virtual Machines for cost savings on fault-tolerant, interruptible workloads.
Warning: Ensure your VM passwords or SSH keys are strong and securely managed. Never expose sensitive credentials in code.
Note: The Azure marketplace provides a wide array of pre-configured VM images to accelerate deployment of common applications and services.

Next Steps

Explore Azure Virtual Machine Scale Sets for automatically managing and scaling a group of identical VMs.

Learn about Azure Hybrid Benefit for cost savings when using existing on-premises Windows Server licenses.