Setting up a Linux Virtual Machine (VM) in Microsoft Azure is a great way to host applications, practice development skills, or run servers in a cloud environment. By using SSH keys for secure access, you’ll also ensure that your VM is protected with a high level of security. This guide will walk you through the steps in detail.
Step 1: Sign in to the Azure Portal
- Open a Web Browser: Type in Azure Portal.
- Log In: Enter your Microsoft account credentials. If you’re new to Azure, create a free account by following the on-screen instructions to set up a trial or free-tier account.
Step 2: Create a Virtual Machine
- Go to “Create a Resource”: In the Azure Portal’s left-hand menu, click “Create a resource”.
- Search for Linux VM: In the search bar, type “Linux” and select “Ubuntu Server” from the list. You can choose any other Linux distribution if preferred, but Ubuntu is a popular and user-friendly option.
- Begin Configuration: Click “Create” to begin setting up your Linux VM.

Step 3: Create Linux Virtual Machine in Azure
In this step, you’ll need to provide some essential details about your VM.
- Click on “Create”: From the dropdown, Click on azure virtual machine
- Under the Basic tab, begin configuring your VM
- Select a subscription
- Select an existing resource or create a new one by clicking on Create new and give it a name, such as “CloudOpsRg1“.
- Under Instance Details, give your VM a name(here I used “JoteTechVM“)
- Under region, select “West US 2″. For availability options, select”No infrastructure redundancy required“. For security type, select “Standard“
- For image type, select “Ubuntu Server 22.04 LTS x64 Gen2“
You can also select other versions or Linux distributions by clicking on See all images

Once you click on See all images, you’ll be presented with the interphase below. It provides a broader view of all images available for you to configure your perfect Azure Linux VM


Step 5: Configure Authentication
Using SSH public keys provides a secure way to connect to your VM without needing a password.
Add Public Key: Copy the contents of your public key (usually in id_rsa.pub on Linux/macOS or generated by PuTTYgen on Windows) and paste it into the SSH public key field in Azure.
Authentication Type: Under Administrator Account, select SSH public key.
Username: Choose a username for your VM, which you’ll use to log in (e.g., “azureuser”).
SSH Public Key: If you don’t have an SSH key pair:
Linux/macOS: Open a terminal and enter:
ssh-keygen -t rsa -b 2048
This generates a pair of keys in your ~/.ssh directory by default. The public key will have a .pub extension.
Windows: Use a tool like PuTTYgen to generate an SSH key pair.

Step 6: Set Up Networking in Linux Virtual Machine in Azure
Azure VM networking lets you control the data flow in and out of your VM.
SSH (port 22): Ensure that SSH (port 22) is enabled, as this is required for SSH access to your VM. You can also add other ports if you plan to run applications on your VM (e.g., HTTP for web servers).
Inbound Port Rules: Under Networking, select Allow selected ports.

Step 7: Review and Create Your Linux Virtual Machine in Azure
- Review Settings: After configuring all required fields, click “Review + Create” at the bottom of the screen.
- Validation: Azure will validate your configurations. If any required settings are missing, you’ll see an error message to correct them.
- Deploy the VM: If validation is successful, click “Create” to deploy your VM. During this process, Azure will set up the VM, create networking resources, and assign an IP address.

Step 8: Download the Private Key and Create Linux Virtual Machine in Azure Resource
Once the VM is created, you’ll need to download the private key and create the resource. In the meantime, you can open up the downloaded public key to access the file location.

Click on Go to Resource to access your VM IP address.

Step 9: Connect to Your Linux Virtual Machine in Azure via SSH
Now that your VM is ready, you can connect to it securely using your SSH key.
- Open an SSH Client:
- Linux/macOS: Use your terminal.
- Windows: Use Command Prompt (make sure to run as Administrator) or PuTTY if you prefer a graphical interface.
- Navigate to Your Private Key: Ensure you’re in the directory where your private key (e.g., id_rsa) is stored. If using PuTTY, you’ll need to convert the .pem file to .ppk format first.
- Run SSH Command: Type the following command to connect. Replace {username} with the username you chose in Azure, and IP_Address with the public IP address you copied:
- ssh -i /path/to/private_key {username}@IP_Address
- Example: If your username is azureuser and your IP is 1.141.165.63, type:
- ssh i C:\Users\user\Downloads JoteTechVM_key.pem azureuser@51.141.165.63
- Confirm Connection: You may be prompted to confirm the host’s authenticity. Type “yes” and press Enter to continue.
- Success: If the connection is successful, you’ll see a command prompt for your VM, indicating that you’re connected.



Welcome to nginx
