DEVELOPER BLOG

HOME > DEVELOPER BLOG > 【Introduction to Azure】SSH Connection in Azure DevOps - PrismScaler

【Introduction to Azure】SSH Connection in Azure DevOps - PrismScaler

1. Introduction

Hello! We are a writer team from Definer Inc. In this issue, you are wondering how to make SSH connections in Azure DevOps. Let's take a look at the actual screens and resources to explain in detail.

2. Purpose/Use Cases

This article summarizes helpful information and practices when you want to make an SSH connection to Azure DevOps.   Here are some specific use cases for SSH (Secure Shell) to Azure:
  1. Remote server administration: SSH provides a secure way to remotely access and manage virtual machines (VMs) or virtual machine scale sets (VMSS) running in Azure. You can use SSH to perform administrative tasks, configure software, update packages, troubleshoot issues, and monitor system logs.
  2. Application deployment and debugging: SSH allows you to deploy applications to Azure VMs and debug them directly on the server. You can transfer files, execute commands, and monitor application logs using SSH. This is especially useful during development, testing, and troubleshooting stages of your application lifecycle.
  3. Secure file transfer: SSH provides a secure channel for transferring files between your local machine and Azure VMs. You can use tools like SCP (Secure Copy) or SFTP (Secure File Transfer Protocol) over SSH to securely upload or download files to/from your Azure VMs.
  4. Tunneling and port forwarding: SSH supports tunneling capabilities, allowing you to create secure connections between local ports and ports on Azure VMs. This can be useful for accessing services or applications running on Azure VMs that are not publicly accessible. You can forward ports through SSH to securely access web applications, databases, or other services hosted on Azure.
  5. Remote command execution: SSH enables you to execute commands on Azure VMs without the need for interactive login. This can be helpful for automation, scripting, or running batch jobs on multiple VMs simultaneously.
  6. Security and access control: SSH plays a crucial role in securing your Azure infrastructure. By disabling password-based authentication and using SSH key pairs, you can enhance the security of your Azure VMs. SSH keys provide stronger authentication and eliminate the risks associated with passwords.

3. SSH Setup

First, we will implement SSH setup. From the Mac terminal, we will perform the following   (1) Create private and public keys First, use the "ssh-keygen" command to create a private and public key.
The only SSH key type supported by Azure DevOps is RSA.
## Key creation command
## -t: Specify the algorithm for the RSA method
## -f: Specify file name
ssh-keygen -t rsa -N "" -b 2048 -C user_name -f test-key           

## return
Generating public/private rsa key pair.
Your identification has been saved in test-key
Your public key has been saved in test-key.pub
The key fingerprint is:
SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxx user_name
The key's randomart image is:
+---[RSA 2048]----+
|                |
|                |
|                |
|                |
|                |
+----[SHA256]-----+                
 

(2) Private key registration

Register the private key to SSH using the "ssh-add" command.

Note that it is the private key, not the public key, that is registered.
## Private Key Registration
ssh-add test-key

## Confirmation of registered keys
ssh-add -l                  

4. Azure DevOps Configuration

Next, we will proceed with SSH configuration on the Azure DevOps side.   (1) Registration of public key Login to Azure DevOps, go to "User settings" → "SSH public keys" → "New Key" Copy the contents of the public key (for example, id_rsa.pub) that you generated into the Public Key Data field. Be careful not to register your private key.   (2) Test From the Azure DevOps screen, go to "Repos" → "Clone to your computer" and copy the URL displayed in "SSH". Confirm the connection with the "git clone" command.   You have successfully accessed Azure DevOps via SSH!
## git clone Command Format
git clone ${Copied URL}
## Actual git clone command executed
git clone ssh.dev.azure.com:v3/definer-test/test-azuredevops/test-azuredevops

## return
Cloning into 'test-azuredevops'...
The authenticity of host 'ssh.dev.azure.com (xx.xxx.xx.xx)' can't be established.
RSA key fingerprint is SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'ssh.dev.azure.com' (RSA) to the list of known hosts.
・・・                

5. Cited/Referenced Articles

6. About the proprietary solution "PrismScaler"

・PrismScaler is a web service that enables the construction of multi-cloud infrastructures such as AWS, Azure, and GCP in just three steps, without requiring development and operation. ・PrismScaler is a web service that enables multi-cloud infrastructure construction such as AWS, Azure, GCP, etc. in just 3 steps without development and operation. ・The solution is designed for a wide range of usage scenarios such as cloud infrastructure construction/cloud migration, cloud maintenance and operation, and cost optimization, and can easily realize more than several hundred high-quality general-purpose cloud infrastructures by appropriately combining IaaS and PaaS.  

7. Contact us

This article provides useful introductory information free of charge. For consultation and inquiries, please contact "Definer Inc".

8. Regarding Definer

・Definer Inc. provides one-stop solutions from upstream to downstream of IT. ・We are committed to providing integrated support for advanced IT technologies such as AI and cloud IT infrastructure, from consulting to requirement definition/design development/implementation, and maintenance and operation. ・We are committed to providing integrated support for advanced IT technologies such as AI and cloud IT infrastructure, from consulting to requirement definition, design development, implementation, maintenance, and operation. ・PrismScaler is a high-quality, rapid, "auto-configuration," "auto-monitoring," "problem detection," and "configuration visualization" for multi-cloud/IT infrastructure such as AWS, Azure, and GCP.