Azure Virtual Machines

Overview

Azure Virtual Machines (VMs) provide on-demand, scalable computing resources with flexible configurations and operating system choices. Use VMs to run applications, host services, and develop/testing environments.

VMs integrate with the broader Azure ecosystem, offering features like managed disks, high availability sets, and auto-scaling.

Key Features

Pricing & Billing

VM pricing is based on selected size, OS, region, and usage type (pay-as-you-go, Reserved Instances, Spot VMs). View the pricing calculator for detailed estimates.

az vm list-skus --location eastus --output table

Quick Start

Deploy a Linux VM using Azure CLI:

# Create a resource group
az group create --name MyResourceGroup --location eastus

# Create a virtual network and subnet
az network vnet create \
  --resource-group MyResourceGroup \
  --name MyVnet \
  --subnet-name MySubnet

# Create a public IP address
az network public-ip create \
  --resource-group MyResourceGroup \
  --name MyPublicIP

# Create a network security group with SSH rule
az network nsg create \
  --resource-group MyResourceGroup \
  --name MyNSG

az network nsg rule create \
  --resource-group MyResourceGroup \
  --nsg-name MyNSG \
  --name AllowSSH \
  --protocol tcp \
  --priority 1000 \
  --destination-port-range 22 \
  --access Allow

# Create a network interface
az network nic create \
  --resource-group MyResourceGroup \
  --vnet-name MyVnet \
  --subnet MySubnet \
  --network-security-group MyNSG \
  --public-ip-address MyPublicIP \
  --name MyNic

# Create the VM
az vm create \
  --resource-group MyResourceGroup \
  --name MyLinuxVM \
  --image UbuntuLTS \
  --admin-username azureuser \
  --generate-ssh-keys \
  --nics MyNic

Best Practices

Frequently Asked Questions

Can I resize a running VM?
Yes, Azure supports resizing VMs without data loss. Some size changes may require a restart.
How do I secure SSH access?
Use network security groups, Azure Bastion, or just-in-time (JIT) access for enhanced security.
What is the difference between a VM and a VM Scale Set?
A VM Scale Set provides automatic scaling and management of a group of identical VMs.