If you’re looking to generate SSH keys and use them to login to an Azure Linux VM then good on you because that’s the recommended and most secure method to access your VMs. It’s readily documented here in official documentation. However, I’ve seen people asking on forums how to simply connect to a Linux VM hosted in Azure via SSH with a username and password. If that’s you then I assume you have a good reason (like this VM will generally not have ports open to the internet or this is a proof of concept) and this post will detail how.

Create the Linux VM

When you create your VM make sure you’ve chosen “Password” as your authentication type as seen here in Step 1. Choose the username and password that you will use when you connect to this machine.

Step 1 of the ‘Create virtual machine’ blade.

On Step 2 choose whatever size you need. On Step 3 make sure you’re creating a Public IP. The default Network Security Group rules will leave port 22 open for inbound SSH connections so you can leave it as is.

Step 3 of the ‘Create virtual machine’ blade.

The default Public IP settings will generate a dynamic IP address which is fine but you will need to get your IP address from the portal every time it changes in order to connect via SSH. If you plan to SSH to this VM often you may want to set it to static.