Interview Prep/Azure/Network Connectivity Errors

A VM with a public IP times out on SSH (`ssh: connect to host 20.x.x.x port 22: Connection timed out`).

BeginnerTroubleshootingNetwork Connectivity Errors
Answer

Likely causes → NSG doesn't allow 22 from your IP (Standard public IPs are closed by default), a second NSG on subnet or NIC, guest firewall, or sshd not running.

Diagnose →

az network nic list-effective-nsg -g rg -n vm-app-nic
az network watcher test-ip-flow -g rg --vm vm-app --direction Inbound --protocol TCP \
  --local 10.20.1.4:22 --remote <yourIP>:50000
az vm boot-diagnostics get-boot-log -g rg -n vm-app | tail

Fix → Add an allow rule for your IP on port 22 (or use Bastion); check sudo ufw status via Run Command: az vm run-command invoke -g rg -n vm-app --command-id RunShellScript --scripts "systemctl status sshd".

Prevent → No SSH from the internet; Bastion or JIT access.

Azure All Azure questions Roadmap: Azure core services

More on Network Connectivity Errors