Skip to main content
In this lesson, you’ll learn how to connect to the virtual machines (VMs) created in the previous lesson using different methods. We will cover accessing VMs via public IP addresses, jumpboxes, and Azure Bastion. Each method has its own benefits and security considerations.

Connecting Using Public IP Address and Jumpbox

One common method to access a virtual machine is by using its public IP address. With a public IP, you can:
  • Use an SSH client (for Linux)
  • Use an RDP client (for Windows)
Another secure option is to connect via a jumpbox. A jumpbox is a machine with a public IP address placed within a dedicated subnet, while your workloads run in a different, private subnet within the same virtual network. By connecting to the jumpbox, you can then access other machines securely on the private network.
The image illustrates a network setup for connecting to virtual machines using a jumpbox within a virtual network, showing connections via private and public IPs. It includes elements like a virtual machine, public IP, and user access.

Connecting with Azure Bastion

Azure Bastion is a managed service that simplifies VM connectivity by allowing secure, direct browser-based access to your VMs. This method eliminates the need to deploy and manage jumpbox VMs, download special clients, or expose any ports directly to the internet.
Azure Bastion enhances security by ensuring that no public ports are exposed, which helps protect your infrastructure from potential attackers.
The image is a diagram illustrating how to connect to virtual machines using Azure Bastion, showing the flow from a bastion host through a virtual network to users.

Overview of Connection Methods

Below is an overview of available connection methods based on the operating system, protocol, and authentication:
  • Windows:
    • RDP: Uses TCP port 3389. Authenticate with a password.
    • WinRM: Utilizes PowerShell for remote management over TCP port 5986 (requires certificate configuration).
  • Linux:
    • SSH: Utilizes TCP port 22. Supports authentication via passwords or SSH key pairs.
The image is a diagram showing methods for connecting to virtual machines, detailing operating systems, protocols/ports, and authentication methods. It includes Windows and Linux systems with protocols like RDP, WinRM, and SSH, and authentication via passwords, certificates, or keys.

Connecting via SSH

To connect to a Linux VM using its public IP address, open your terminal and run:
When you run the command, you will be prompted to verify the host authenticity and enter the password:
Once authenticated, you are connected to the VM using its public IP address. Alternatively, you can reconnect using the jumpbox that was set up earlier. Below is a sample output of system information from one of our VMs to confirm connectivity via the jumpbox:

Deploying VMs for Azure Bastion

Now, let’s explore how to use Azure Bastion. The following PowerShell script creates two VMs—one Linux and one Windows—both with private IP addresses. These VMs are ideal for secure access via Bastion.
After the script completes, verify that the VMs appear in the virtual machines list. Since these VMs do not have public IP addresses, they are perfectly suited for private access using Azure Bastion.
The image shows a Microsoft Azure portal displaying a list of virtual machines, including details like name, type, subscription, location, status, operating system, size, and public IP address.

Configuring Azure Bastion

Follow these steps to set up a Bastion host:
  1. Navigate to the Bastion resource in the Azure portal.
  2. Create a new Bastion host with the settings below:
    • Resource Group: Remote Access
    • Name: RABastion01
    • Region: East US
    • Tier: Basic (to minimize costs)
  3. Choose the virtual network (vnet-remoteaccess) and ensure Bastion has a dedicated subnet named “AzureBastionSubnet” by clicking on “Manage subnet configuration.”
  4. Create a new public IP address.
  5. Click “Review and Create” to deploy Bastion.
The image shows a Microsoft Azure portal page for creating a Bastion host, with fields for project and instance details such as subscription, resource group, name, region, and tier.
Once the Bastion host is deployed, you can connect to your VMs privately through your browser.

Connecting to the Linux VM via Azure Bastion

  1. Open the Azure portal and navigate to the Linux VM.
  2. Click on “Connect” and select “Connect via Bastion.”
  3. Enter your username and password, then click “Connect.”
A new browser tab will open with an SSH session to the Linux VM. You can run commands as usual. For example, update the package list:

Connecting to the Windows VM via Azure Bastion

  1. In the Azure portal, navigate to the Windows VM.
  2. Click on “Connect” and choose “Connect via Bastion.”
  3. Enter the required credentials and click “Connect.”
This will open an RDP session in your browser with the Windows login screen. Once you sign in, you can securely manage the Windows VM.
Using Azure Bastion provides secure, private access to your VMs without exposing them to the public internet.

Next Steps

In the next lesson, we will explore how to configure high availability for your virtual machines. By following these best practices, you’ll enhance the security and efficiency of your remote access setup. For more information, refer to the following resources:

Watch Video