Lesson 3 of 4 Securing Virtual Machines

Planning and Implementing Azure Bastion

This lesson explains how Azure Bastion gives remote access without public addresses, and how to choose a SKU.

Learning outcomes

After completing this lesson, you will be able to:

  • Explain the problem that Bastion solves.
  • Identify its requirements.
  • Choose a SKU.
  • Distinguish Bastion from just-in-time access.

The problem with exposed management ports

Automated scanners find a public RDP or SSH port within minutes, and brute-force attempts follow at once. Reducing this exposure is one of the most effective steps in securing a VM. Azure Bastion is a managed service in a virtual network that lets administrators reach VMs over TLS through the Azure portal or a native client. The VMs need no public IP address, no agent and no client software in the guest, and only the Bastion host talks to their private addresses.

A traditional jump box is a VM that the customer must patch and protect. Bastion is a hardened service that Microsoft operates, so it removes that burden.

Requirements

Bastion has precise requirements, and exam questions test them.

  • A subnet named exactly AzureBastionSubnet, in the same virtual network, with a size of /26 or larger, holding no other resources. Existing /27 subnets created before November 2021 still work. The Developer SKU has no such subnet.
  • A public IP address that is Standard and Static, except for the Developer SKU and for private-only deployments.
  • The default ports of 3389 for RDP and 22 for SSH to reach targets, or custom ports with Standard or higher.
  • Peered virtual networks can be reached from a single Bastion host, so one Bastion can serve a hub-and-spoke network.

NSGs on target subnets must allow inbound RDP and SSH from the Bastion subnet's address range. That lets you close those ports to everything else, so that Bastion is the sole route. An NSG on the Bastion subnet itself is optional, and if present it needs specific rules for the service to work.

The following diagram shows a Bastion deployment and its requirements.

Azure Bastion as the only route to VM management ports. A user connects over TLS from the portal or a native client to Bastion, which runs in a subnet named AzureBastionSubnet of /26 or larger with a Standard static public IP. Bastion opens RDP or SSH to the VMs' private addresses, in its own and peered virtual networks. NSGs on the target subnets allow RDP and SSH only from the Bastion subnet, and the VMs need no public IP.
Bastion becomes the only route to RDP and SSH.
True or false

Bastion requirements

Exam skills 3.2.2

Check the deployment requirements for Azure Bastion.

Log in to try this activity Interactive activities are free with an account.

SKUs

Each SKU adds capabilities. The following table summarizes those that are most likely to decide a scenario.

SKUKey characteristics
DeveloperA free, shared option for development. It connects to VMs in one virtual network, and needs no dedicated subnet or public IP address.
BasicDedicated deployment with two instances, which cannot be scaled.
StandardAdds host scaling, custom ports, shareable links and native client support.
PremiumAdds session recording, and supports private-only deployment.

Session recording stores graphical sessions in a blob container, reached by a SAS URL, which suits auditors who need to see what administrators did. Private-only Bastion has no public address, so that users must reach it across a private route such as ExpressRoute. A shareable link allows someone with no Azure portal access to connect to a specific VM, so use it with care. Upgrading from one SKU to a higher one is possible, but downgrading is not.

Sort into groups

Which Bastion SKU?

Exam skills 3.2.2

Choose the lowest Bastion SKU that meets each requirement.

Log in to try this activity Interactive activities are free with an account.

Native client and Microsoft Entra sign-in

With Standard or higher, an administrator can use a local RDP or SSH client through the Azure CLI, which gives a better experience and enables file transfer. Access to a VM through Bastion needs Reader on the VM, its NIC and the Bastion resource, plus sign-in rights on the guest. If a VM supports Microsoft Entra login, then combining that with Bastion gives identity-based sign-in, Conditional Access and no shared local passwords.

az network bastion ssh --name BASTION --resource-group RG --target-resource-id VM_ID \
  --auth-type AAD

Comparing Bastion with JIT

Azure Bastion and just-in-time access are often confused, and they solve related but different problems, as the following comparison shows.

Azure Bastion
PurposeProvides a secure path
Needs a public IP on the VMNo
Needed plan or SKUA Bastion SKU
Effect on portsPorts stay closed to the internet
Just-in-time VM access
PurposeLimits when a port is open
Needs a public IP on the VMNot necessarily, but often used with one
Needed plan or SKUDefender for Servers Plan 2
Effect on portsPorts open for a limited time

They can work together: JIT can govern the window in which the Bastion subnet may reach a VM's port. For a scenario that demands no public IP addresses on VMs, Bastion is the answer.

Worked example

Choosing a SKU

A company runs VMs across five peered spokes. Administrators must connect without public IP addresses on the VMs, using their local SSH clients. The auditors require recordings of each session. Which deployment should you recommend?

Deploy one Azure Bastion Premium instance in the hub, in AzureBastionSubnet of /26 or larger. Peering lets it serve the spokes, Standard or higher supports native clients, and only Premium supports session recording.

Standard would meet everything but the recording requirement. Developer serves a single network and has no recording. A jump box with a public address would add the exposure that the company wants to avoid.

Check yourself

Can a /27 subnet be used for a new Bastion deployment?

Show answer

No. New deployments need /26 or larger. Older /27 subnets continue to work.

Exam Tips

Remember for the exam

  • The subnet must be named AzureBastionSubnet, and be /26 or larger.
  • Standard adds native client and scaling; Premium adds session recording.
  • One Bastion can serve peered networks.
  • Target NSGs must allow RDP and SSH from the Bastion subnet.