Linux Virtual Machines in Azure

Linux Virtual Machines in Azure

Linux Virtual Machines in Azure

Azure supports a wide range of Linux distributions and versions, including:

  • CentOS by OpenLogic

  • CoreOS

  • Debian

  • Oracle Linux

  • Red Hat Enterprise Linux (RHEL)

  • Ubuntu

Linux Distribution Highlights

When working with Linux virtual machines in Azure, keep the following in mind:

  • Hundreds of Linux images are available through the Azure Marketplace.

  • Linux VMs support the same deployment methods as Windows VMs:

    • Azure Portal

    • PowerShell (Azure Resource Manager)

    • Azure Command-Line Interface (CLI)

  • Linux virtual machines integrate well with popular open-source DevOps tools, such as:

    • Puppet

    • Chef

✔️ Take a few minutes to review the Linux distributions available in the Azure Marketplace and identify any that meet your workload needs.

For more information, see the official documentation:
https://docs.microsoft.com/en-us/azure/virtual-machines/linux/


Linux VM Connections

When creating a Linux virtual machine in Azure, you can authenticate using either:

  • SSH public key authentication (recommended)

  • Username and password


SSH Connections

Secure Shell (SSH) is the default connection protocol for Linux virtual machines in Azure. SSH encrypts all communication between your local system and the VM, making it safe to use over unsecured networks.

While SSH supports password-based authentication, this method can leave the VM vulnerable to brute-force attacks. A more secure and recommended approach is SSH key-based authentication.

How SSH Keys Work

  • The public key is placed on the Linux VM.

  • The private key remains on your local system and must be protected.

  • When you attempt to connect, the VM verifies that your client possesses the matching private key.

  • If verified, access is granted.

You may reuse a single key pair across multiple Azure VMs and services, depending on your organization’s security policies.

⚠️ Important Security Notes

  • Never share your private key.

  • Azure requires at least a 2048-bit RSA key in SSH-RSA format.

  • Protect private keys with a passphrase whenever possible.


Demonstration: Connect to a Linux Virtual Machine Using SSH

Note: Ensure port 22 is open on the VM’s network security group (NSG).


Step 1: Create SSH Keys Using PuTTYgen

  1. Download PuTTY from https://putty.org/ (includes PuTTYgen).

  2. Open PuTTYgen.

  3. Select RSA under Parameters.

  4. Click Generate.

  5. Move your mouse in the blank area to generate randomness.

  6. Copy the Public key text.

  7. (Optional but recommended) Enter and confirm a Key passphrase.

  8. Click Save private key.

  9. Save the private key file securely—you’ll need it to access the VM.


Step 2: Create the Linux VM and Assign the Public Key

  1. In the Azure Portal, create a Linux virtual machine.

  2. Choose SSH Public Key as the authentication type.

  3. Enter a username.

  4. Paste the public key into the SSH public key field and confirm validation.

  5. Create the VM and wait for deployment to complete.

  6. Open the VM’s Overview blade.

  7. Click Connect.

  8. Note the username and public IP address.


Step 3: Access the VM Using PuTTY

  1. Open PuTTY.

  2. Enter username@publicIPAddress in the Host Name field.

  3. Set Port to 22.

  4. Select SSH as the connection type.

  5. In the Category panel, expand SSH, then select Auth.

  6. Browse to and select your private key file.

  7. Return to the main PuTTY screen and click Open.

  8. You are now connected to the Linux VM via the command line.