Generate and Use SSH Keys for Azure Linux Virtual Machine Authentication

In this IT Pro Challenge virtual lab, you will get hands-on experience configuring SSH authentication keys for a Microsoft Azure-based Linux system. These skills are essential for a Linux system administrator, for the administration of platforms that use the SSH service, for Penetration Testers, and cybersecurity professionals.

45 minutes
Join over 3 million cybersecurity professionals advancing their career
Sign up with
Required fields are marked with an *

Already have an account? Sign In »


Lab Overview:

This hands-on lab provides an Azure administrator of a Linux environment with an understanding of how to set up a new pair of SSH authentication keys. You will use the SSH client PuTTY (from your local computer) to generate public and private SSH keys. Then, you will learn how to apply the public key to an Azure-based Linux system. To confirm the configuration is correct, you will then use PuTTY to connect to the cloud-based Linux system over SSH remotely.

Understand the scenario

You are a system administrator for a company that uses Linux virtual machines in Microsoft Azure. You need to configure SSH public-key authentication through Azure for a Linux virtual machine. To perform these tasks, you will need to download and use PuTTY, an SSH and Telnet client (available from You will generate the authentication keys on your local system, then update your Azure-based Linux system with the new public key.

Use puttygen.exe to generate an SSH key pair:

To perform this task, you will need to have PuTTY installed on your local computer. PuTTY installation includes the installation of the tool puttygen.exe, which is a Key Generator. This tool allows you to generate a random set of authentication keys to use for Secure Shell (SSH) connections. You will generate an SSH RSA 2048-bit key pair (public and private). Remember to save your keys and protect your private key! You will need to copy the text string of your newly generated public key, to apply to the Azure-based Linux system.

Configure SSH public key authentication:

In this section, you will administer the SSH public key authentication of an Azure-based Linux system. You will navigate the Azure portal, find your Linux virtual machine, and reset the SSH public key configuration to your new key. This demonstrates the ease of administration of your Linux host via the Azure portal.

Configure PuTTY to use the SSH private key:

After the cloud-based Linux system is configured with its new SSH public key, you will attempt to access it using the SSH client, PuTTY remotely. Here, you will connect to the remote Linux system using its IP address, over port 22 (SSH), and using the locally stored SSH private key. You will initiate the connection and should establish an SSH session with a terminal window, returning a CLI on the remote Linux system.

Lab Summary Conclusion:

In this hands-on virtual lab, you will learn how to generate new SSH RSA 2048-bit authentication (public and private) keys. You will then learn how to apply the public key to your Azure-based Linux virtual machine. You will then test the implementation by remotely connecting to the system, from your local computer, using PuTTY, an SSH client. The lessons learned in this lab are valuable to a Linux administrator, a system administrator that hosts the SSH service, a Penetration Tester, and cybersecurity professionals.

Other Challenges in this series:

  • GUIDED CHALLENGE: Create a Scheduled Linux Backup Script
  • ADVANCED CHALLENGE: Can you Configure Linux Rsyslog Forwarding?