Azure

Setup Azure Linux Public Key Authentication

The process to Setup Azure Linux Public Key Authentication is quick and easy and only takes a few minutes. Let's take a look at how to do this

In working with Linux VMs in Azure, there are a couple of ways to setup authentication. ย One being standard password authentication, and the other is Public Key Autentication. ย With Public Key Authentication, a key pair is generated. ย The public key is housed on the Azure Linux VM and the private key is used by the client to authenticate to the Linux VM. ย It is a highly secure means of authenticating as a user has to know two pieces of information if the key is secured with a password (recommended). ย First, they have to possess the private key file, and second, they have to know the password that is assigned to that private key. ย Let’s take a look at how to setup Azure Linux public key authentication.

Setup Azure Linux Public Key Authentication

First things first, we need to create a new Linux VM. ย Below we are spinning up a new Ubuntu Server 16.04 LTS VM. ย Under theย Authentication Type we want to selectย SSH public key.

azure05

Generating the public key

How do we get the value to populate the SSH public key? ย We can useย puttygen to do this for us. ย Let’s open up puttygen and create a public/private key pair. ย Putty Key Generator or puttygen has a unique way of generating the key. ย You generate randomness by moving the mouse in the blank area that is displayed in the app.

puttygen01

As you are moving the mouse, you will see the progress indicator moving from left to right as the key is generated by your movements.

puttygen02

Once complete, theย public key is displayed in the interface. ย Notice also, you have the option toย Save public key andย Save private key. ย I would recommend saving both of these onto an encrypted drive, location, etc for security purposes. ย You will need the private key to establish the connection from your remote client. ย Also, make sure to populate theย Key passphrase with a strong password. ย You will receive a prompt from the remote Linux VM asking for this passphrase upon connection with the private key.

puttygen03

Setting up Putty Connection to Azure Linux VM

To setup your putty connection, you need to obtain your public IP from the Azure portal. ย Then under your putty connection, scroll down toย SSH >> Auth. ย Here we can browse to and select ourย private key.

puttygen04

Now, when we connect as you see below, we see that it is authenticating with the private key, and it is asking for theย Passphrase for key which is the password that is setup during the public/private key generation.

puttygen05

Thoughts

Public/private key authentication is a great way to secure your Azure Linux VM. ย The process toย Setup Azure Linux Public Key Authentication is not difficult at all and only takes minutes to get in place. ย It is a great way to make sure your Azure Linux VM has a strong authentication mechanism for remote connections.

Subscribe to VirtualizationHowto via Email ๐Ÿ””

Enter your email address to subscribe to this blog and receive notifications of new posts by email.



Brandon Lee

Brandon Lee is the Senior Writer, Engineer and owner at Virtualizationhowto.com, and a 7-time VMware vExpert, with over two decades of experience in Information Technology. Having worked for numerous Fortune 500 companies as well as in various industries, He has extensive experience in various IT segments and is a strong advocate for open source technologies. Brandon holds many industry certifications, loves the outdoors and spending time with family. Also, he goes through the effort of testing and troubleshooting issues, so you don't have to.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.