Deploying a Linux Virtual Machine (VM) in Microsoft Azure and Connecting to it via SSH

Deploying a Linux Virtual Machine (VM) in Microsoft Azure and Connecting to it via SSH

Here's how to deploy a Linux Virtual Machine (VM) in Microsoft Azure and connect to it via SSH

STEP 1

Sign in to the Azure Portal: Log in to your Azure account through the Azure Portal.

On the Azure portal dashboard, click the “Virtual Machines" button.

Note --> Remember to create your Resource Group & Give it a preferred name. Your Virtual Machine will be placed inside your Resource Group.

STEP 2

Select “Azure Virtual Machine” under the “Create” drop-down button to create a Virtual Machine hosted by Azure.

STEP 3

Select your subscription. To organize your resources, create or choose a resource group as earlier noted. Enter a name for the virtual machine. Select a deployment region. Select an Availiabitly Zone. Choose the Ubuntu Server image from the "Image" menu. Select a VM size to support the workload that you want to run.

STEP 4

Authentication & Account:

Select the Authentication Type SSH public key

Enter a username for the VM in the "Administrator account" section. For the administrator account, generate a new key pair and give the key pair a preferred name.

Settings:

Allow SSH traffic by opening port 22 (SSH) in the inbound port rules.

Review + Create & Download Key Pair:

Examine your virtual machine configuration. To begin the deployment process, click the "Create" button. Delay Deployment and ensure you download the newly generated key pair:

STEP 5

Azure will deploy the VM based on your configuration. Wait for the deployment to finish. Go to the Resource to obtain the assigned Public IP Address:

STEP 6

Go to the VM's details page after it has been deployed. Take note of the VM's public IP address. Connect. You can SSH via Azure Portal or Via Power Shell

1st Option: Via Azure Portal:

Click “SSH using Azure CLI” to quickly connect via Azure Portal in your browser. This Supports Azure AD authentication and a private key is not required. Type “Yes” when prompted if you want to continue connecting to successfully connect via SSH to the Linux Operating System.

2nd Option: Via Powershell:

Open Windows Powershell (Run as administrator)

Type “az login” in the Powershell CLI

SSH to the Virtual machine. From your power shell in Windows type the command:

Example: ssh -i "C:\Users\Dell\Downloads\VMDejiLinux_User_Key.pem" VMDejiLinux_User@ 20.77.65.156 to successfully connect via SSH to the Linux Operating System