Adding SSH keys to Azure DevOps

Published on
June 16, 2022
Contributor
Sathishkumar Krishnasamy
Senior Platform Architect
Subscribe to newsletter
By subscribing you agree to with our Privacy Policy.
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Share

As a part of the routine development cycle, we need to clone the code from Azure Repos to the local machine and pushing modified code to Azure Repos. To connect with Azure Repos, connecting through SSH is one of the easiest ways. Today, I am going to show you detailed steps on how to configure SSH for Azure DevOps.

SSH public key works with an asymmetric pair of generated encryption keys. We will load the public key with Azure DevOps and safely keep the private key on the local machine.

Following are the steps to configure SSH for Azure DevOps –

Step 1: Generate SSH keypairs

SSH-keygen -C “myuser@cloudaeon.net

This step will generate id_rsa (private key) and id_rsa.pub (public key) in the local system. Make sure to protect the private key. If it is compromised, attackers can use it to attack your system by impersonating you.

Step 2: Add the public SSH key to Azure DevOps

Login to the Azure DevOps portal.

Under ‘User settings’ page select “SSH public keys”

In the above page select “New key” and pass the public key name and public key data and click “Add”.

Now the public SSH key is updated with Azure DevOps.

Step 3: Test SSH connection

Run the command “SSH -T git@SSH.dev.azure.com” to validate the SSH connection. It will provide the output as “shell access not supported” as the shell is restricted but communication is working.

Step 4: Clone the repository

By using the above steps, we have successfully configured and validated the SSH connection with Azure DevOps. Now we can clone the Azure Repos to our local workspace.

#git clone git@SSH.dev.azure.com:v3/sathish0699/testproject/testproject

You can copy the SSH clone command from Azure Repos and execute on your local machine. This will fetch the repo contents to your local system.

Finally, we have successfully generated SSH keypairs and configured Azure DevOps and local machine to clone the Azure Repos.

Experience Azure to build and deploy the apps your way

Contact us to start your journey today

Privacy PolicyTerms of ServiceSitemap
© 2022 Cloudaeon All Rights Reserved.