Generate and use a SSH Key with PuTTY and an Azure Linux VM

Generating a SSH key and use the result to log in to your Azure Linux VM is not that hard to accomplish.
In the following article I want to go over the steps.

Get PuTTYgen to generate your SSH key

First we need to download another “PuTTY” tool called PuTTY Key Generator.
Azure SSH PuTTYgen
Just download the PuTTYgen executable and start it.

Create a new SSH key

Next you want to make sure that SSH-2 RSA is marked.

Azure SSH Create Key
Hit “Generate” and make sure to move the mouse within the blank area of the application.

Save the key

If your key is created you can optional set a passphrase (this would prompt you for a password on a login with your key). Also you want to save the private key (we need it later for PuTTY).

Azure SSH Save Key

In the key field, select the hole content and copy it to the clipboard.

Add the SSH key to Azure

Login to Azure, select your VM, “All Settings” and “Reset password“. Enter a username (please mind the info box above the “User name” field) and select “SSH public key“. Insert your copied key into the text box and hit “Save“.

Azure SSH Add Key

Log in to your VM via PuTTY

When your settings are saved, open PuTTY enter your login ip / url on the start form, then select “Connection -> SSH -> Auth” and hit “Browse …“.

Now select your saved private key and hit “Open“.

Azure SSH PuTTY Keyfile
If everything worked out, PuTTY will ask for a username (optional your passphrase). Enter the username from the Azure Portal and you are logged in.

You may also like...