Dev.to
7/21/2026

Securing Azure Linux Virtual Machines with SSH Keys and Network Security Groups
Short summary
A step-by-step guide to securing an Azure Linux VM using 4096-bit RSA SSH keys and Network Security Group rules. Covers key generation, VM deployment via Azure CLI, locking down port 22 to a specific source IP, and verifying the NSG rule blocks unauthorized connections. Includes cleanup commands to avoid ongoing charges.
- •Generate 4096-bit RSA SSH keys and deploy Ubuntu 22.04 VM with public key auth
- •Create NSG rule restricting SSH (port 22) to your specific public IP only
- •Verify unauthorized connections time out and clean up resources to avoid charges
Generated with AI, which can make mistakes.
Is this a good recommendation for you?



