Create a Linux VM, configure inbound ports, connect via SSH, and understand VM sizing and cost.
az vm create \
--resource-group myapp-rg \
--name my-linux-vm \
--image Ubuntu2204 \
--size Standard_B1s \
--admin-username azureuser \
--generate-ssh-keys
# Open port 80 for web traffic
az vm open-port --resource-group myapp-rg --name my-linux-vm --port 80
az vm open-port --resource-group myapp-rg --name my-linux-vm --port 443
# Get the public IP
az vm show -d -g myapp-rg -n my-linux-vm --query publicIps -o tsv
# SSH in
ssh azureuser@# Once SSH'd in:
sudo apt update && sudo apt install -y nginx
sudo systemctl enable nginx
sudo systemctl start nginx
# Visit the public IP in your browser — you should see the Nginx welcome page# Deallocated = no compute charges (storage still billed)
az vm deallocate --resource-group myapp-rg --name my-linux-vm
# Start again
az vm start --resource-group myapp-rg --name my-linux-vmaz vm deallocate, not just stop, when you're done for the day.Standard_B1s is the smallest VM size — cheap for experiments. Production uses larger sizes.--generate-ssh-keys creates a key pair and stores it locally. Use it — don't use passwords.az vm deallocate stops billing for compute. Don't just 'stop' — that still charges.