Connect to VMs Securely with Azure Bastion
30-second answer
Azure Bastion is a managed service that lets you RDP and SSH to VMs on their private IPs from the Azure portal over TLS 443, so VMs need no public IP and no open 3389 or 22 to the internet. It's deployed into a subnet named exactly AzureBastionSubnet, /26 or larger, with a Standard public IP, and it reaches VMs in its own VNet and peered VNets. SKUs are Developer (free, shared, no subnet), Basic, Standard (adds host scaling, native client support with az network bastion ssh/rdp, IP-based connection, shareable links) and Premium (adds session recording and private-only deployment).
Exam objective: 4.2.3 Implement Azure Bastion. (Skills measured as of April 17, 2026)
Simulations
Feel it before you read it. No account needed, nothing leaves this page.
Search for <strong>Bastions</strong>.
👆 Click the glowing item in the portal to continue
Read the steps as text
- Search for Bastions.
- Type bastions in the search bar and pick Bastions under Services.
- Bastion needs AzureBastionSubnet (/26 or larger) and a Standard public IP. The VMs themselves need neither.
- On Advanced, turn on Native client support (Standard or Premium only) if admins want to use their own SSH or RDP client.
- Review and Create. It takes about 10 minutes.
- Open the VM app01. It has no public IP. Select Connect.
- Choose Connect via Bastion, enter the username and key or password, and the SSH session opens in a browser tab over TLS 443.
- Admins can see and end sessions here. No VM exposes port 22 or 3389 to the internet.
🧪 Simulation for learning. Screens are simplified versions of the Azure portal; names, prices and IDs are examples. Nothing here touches real Azure.
🖱️ Drag to rotate · scroll or pinch to zoom
Azure Bastion
Azure Bastion lives in AzureBastionSubnet (/26 or larger) and opens RDP and SSH to VMs on their private IPs, from the portal over TLS 443 or with the native client on Standard and Premium. One Bastion in the hub serves peered spokes.
🤔 What happens if…
Read this tour as text
- VNets, subnets and a public IP. A virtual network is your private range in one region, split into subnets. Azure keeps 5 addresses in every subnet. A Standard public IP is static, zone-redundant where the region has zones, and closed to inbound traffic until an NSG opens it.
- Peering is not transitive. VNet peering joins two VNets over the Microsoft backbone. Each side has its own link, address spaces can't overlap, and the hub can share its VPN gateway (gateway transit). Peering never chains: spoke 1 and spoke 2 can't talk through the hub on their own.
- User-defined routes to the NVA. A route table on a subnet overrides system routes. Next hop Virtual appliance sends traffic to a firewall or NVA, which needs IP forwarding on its NIC. Longest prefix wins, and a user route beats a system route on the same prefix.
- NSGs, ASGs and effective rules. An NSG has rules checked by priority (100 to 4096, lowest first). Inbound traffic meets the subnet NSG first, then the NIC NSG, and both must allow. An application security group lets a rule say "to the web servers" instead of listing IPs.
- Azure Bastion. Azure Bastion lives in AzureBastionSubnet (/26 or larger) and opens RDP and SSH to VMs on their private IPs, from the portal over TLS 443 or with the native client on Standard and Premium. One Bastion in the hub serves peered spokes.
- Service endpoint vs private endpoint. A service endpoint sends a subnet's traffic to the service's public IP over the backbone, and the service firewall allows that subnet. A private endpoint gives the service a private IP in your VNet, and a privatelink private DNS zone makes the name resolve to it.
- Azure DNS: public and private zones. A public zone answers the internet once you delegate the domain to Azure's name servers. Alias records point at Azure resources such as a public IP. A private zone answers only VNets with a virtual network link, and can auto-register VM names.
- Standard load balancer and health probes. A load balancer spreads TCP/UDP flows from a frontend (public or internal) to a backend pool by load-balancing rules. A health probe pulls a VM out of rotation when it stops answering. Probes come from 168.63.129.16.
- Troubleshoot with Network Watcher. Network Watcher tools answer one question each. IP flow verify: which NSG rule allows or denies this flow? Next hop: where does this packet go? Connection troubleshoot: can A reach B, and if not, at which hop?
Fabrikam's app VMs must reach a storage account without the public internet, and admins must reach the VMs without public IPs. Compare a service endpoint with a private endpoint, see why a private endpoint without private DNS does nothing, and stand up Azure Bastion (after a subnet that's too small).
🎓 Education-only simulation. Your lab is saved in this browser, so you can leave and continue later.
😟 THE PROBLEM
Admins RDP to VMs through public IPs and the logs show brute-force attempts all day.
😊 THE SOLUTION
Remove the public IPs and connect through Azure Bastion on private IPs.
- Port 3389 open to the world✓ No public IP on the VM
- Jump box to patch and secure✓ Managed PaaS host
- Admins want their own client✓ Standard SKU with native client
Start with a question
How does a hotel let a plumber into room 214 without giving them a master key?
The plumber signs in at the front desk. Someone walks them up, opens 214, and stays while they work. The plumber never gets a key, and no room door faces the street.
Azure Bastion is that front desk. Admins sign in through the Azure portal over HTTPS, and Bastion opens the RDP or SSH session to the VM’s private address. The VMs don’t need public IPs, so there’s no door on the street for attackers to try.
Explain it like I’m 10
The technical explanation
How it works
- The admin opens the VM in the portal and selects Connect → Connect via Bastion (or runs the native client command).
- The browser talks to Bastion over TLS 443, after Microsoft Entra sign-in and Azure RBAC checks.
- Bastion opens RDP (3389) or SSH (22) to the VM’s private IP inside the VNet.
Bastion is a hardened, managed host: no OS for you to patch, no jump box to secure.
What you need
| Requirement | Detail |
|---|---|
| Subnet | Named exactly AzureBastionSubnet, /26 or larger (a /26 gives room for host scaling) |
| Public IP | Standard, static (not needed for Developer or private-only Premium) |
| Reach | VMs in the same VNet and in peered VNets |
| VM NSG | Allow 3389/22 from the AzureBastionSubnet range (or VirtualNetwork) |
| Permissions | Reader on the VM, its NIC and the Bastion resource |
If you put an NSG on AzureBastionSubnet itself, it needs specific rules (inbound 443 from Internet and from GatewayManager, outbound to the VNet on 3389/22, to AzureCloud on 443, and so on). Route tables aren’t supported on that subnet.
SKUs
| Feature | Developer | Basic | Standard | Premium |
|---|---|---|---|---|
| Portal RDP/SSH | ✅ | ✅ | ✅ | ✅ |
| Dedicated host, peered VNets | No | ✅ | ✅ | ✅ |
| Host scaling (2 to 50 instances) | No | No | ✅ | ✅ |
Native client (az network bastion ssh/rdp) | No | No | ✅ | ✅ |
| IP-based connection, shareable link | No | No | ✅ | ✅ |
| Session recording, private-only deployment | No | No | No | ✅ |
You can upgrade a SKU in place but not downgrade. Price feel: Basic is around $0.19 an hour plus outbound data (illustrative), Standard costs more per hour plus per extra instance.
Portal and CLI
Portal: create AzureBastionSubnet in the VNet, then Bastions → + Create (tier, instance count, VNet, public IP) and on Advanced tick Native client support if needed. You can also choose Enable Azure Bastion on the Security tab when creating a VNet.
az network vnet subnet create -g rg-net-paas --vnet-name vnet-paas -n AzureBastionSubnet --address-prefixes 10.30.3.0/26
az network public-ip create -g rg-net-paas -n pip-bastion --sku Standard --allocation-method Static
az network bastion create -g rg-net-paas -n bas-paas --vnet-name vnet-paas \
--public-ip-address pip-bastion --sku Standard --enable-tunneling true --location eastus
az network bastion ssh -g rg-net-paas -n bas-paas --target-resource-id <vm-resource-id> \
--auth-type AAD
az network bastion update -g rg-net-paas -n bas-paas --scale-units 4
PowerShell: New-AzBastion -ResourceGroupName rg-net-paas -Name bas-paas -PublicIpAddress $pip -VirtualNetwork $vnet -Sku Standard.
Architect level Bastion or just-in-time VM access?
Microsoft Defender for Cloud’s just-in-time access opens a management port on the NSG for a short time to one source IP. It reduces exposure but still needs a public IP on the VM. Bastion removes the public exposure entirely. Many teams use Bastion for everyday admin and keep VPN or ExpressRoute for bulk access from the office.
Real-world business scenario
Fabrikam Manufacturing (fictional)
- The problem
- Every factory-floor VM had a public IP with RDP open so contractors could support it. The security team counted 40,000 failed sign-ins a day.
- What they used
- Azure Bastion Standard in the hub VNet with native client support, peered to every factory spoke. Public IPs removed from VMs, and spoke NSGs allow 3389 and 22 only from the AzureBastionSubnet range.
- Why that choice
- Contractors still connect, through the portal or their own clients, but no VM is reachable from the internet.
- The result
- Failed sign-in attempts on VMs dropped to zero, and the audit log shows who opened every session.
When to use it and when not to
✓ Use it when…
- Admins need RDP or SSH to VMs that must not have public IPs.
- A hub and spoke network where one Bastion can serve every peered VNet.
- Contractors who need access without VPN clients (shareable links on Standard).
✕ Think twice when…
- Connecting whole offices or apps to a VNet. Use a VPN gateway or ExpressRoute.
- Expecting native client or host scaling on Basic.
- Tiny subnets: anything smaller than /26 fails.
↔ Alternatives to consider
- Point-to-site VPN when admins need full network access, not just RDP/SSH.
- Just-in-time VM access in Defender for Cloud to open ports briefly.
- Bastion Developer for free, one-at-a-time access in dev and test.
Test yourself with exercises
5 original practice questions in the AZ-104 style. Pick your answers, then check them. You will see why each option is right or wrong. Score 75% or more and this topic is marked complete.
Interview preparation
Say your answer out loud first, then open the model answer. Interviewers care more about your reasoning than the exact words.
Beginner Why use Azure Bastion instead of giving each VM a public IP?
Model answer
With a public IP and port 3389 or 22 open, the VM is exposed to the whole internet and gets brute-force attempts within minutes. Bastion keeps the VMs private. Admins connect to Bastion over HTTPS, and Bastion opens RDP or SSH to the VM's private IP.
Intermediate What does Bastion need to deploy?
Model answer
A subnet named exactly AzureBastionSubnet in the VNet, at least /26, and a Standard static public IP (except the Developer SKU). It's billed per hour plus outbound data, so I usually put one in the hub and let it serve peered spokes.
Experienced developer An admin wants to SSH from their laptop terminal through Bastion. What do you set up?
Model answer
Upgrade Bastion to Standard or Premium and enable native client support. Then the admin runs az network bastion ssh with the VM's resource ID, or az network bastion rdp on Windows. Basic only supports connecting from the portal.
Scenario Bastion is in the hub, but you can't connect to a VM in a spoke. What do you check?
Model answer
That the spoke is peered with the hub and both links are Connected. Then the NSG on the VM's subnet: it must allow 3389 or 22 from the AzureBastionSubnet range. And that the VM is running and the user has Reader on the VM, its NIC and the Bastion resource.
Quick revision
Key points
- Bastion gives RDP/SSH over TLS 443 to private IPs. VMs need no public IP.
- AzureBastionSubnet, exact name, /26 or larger, plus a Standard public IP.
- Reaches VMs in its VNet and peered VNets.
- Developer (free, shared), Basic, Standard (scaling, native client, shareable link, IP-based), Premium (session recording, private-only).
- You can upgrade a SKU but not downgrade it.
Important terminology
- Azure Bastion
- A fully managed PaaS service that provides RDP and SSH to VMs over TLS from the portal or a native client, using the VMs' private IPs.
- AzureBastionSubnet
- The dedicated subnet Bastion is deployed into. The name must be exact and the size /26 or larger.
- Native client support
- A Standard or Premium setting (tunneling) that lets you connect with your local SSH or RDP client through az network bastion ssh or rdp.
- Host scaling
- Changing the number of Bastion instances (Standard and Premium, 2 to 50) to support more concurrent sessions.
- Shareable link
- A Standard feature that gives a user a URL to connect to one VM through Bastion without portal access.
- Developer SKU
- A free, shared Bastion option for dev and test that connects one VM at a time, with no dedicated subnet or public IP.
Common mistakes
- Naming the subnet BastionSubnet or making it a /27.
- Expecting az network bastion ssh to work on the Basic SKU.
- Blocking 3389/22 from the Bastion subnet in the VM's NSG.
Exam tips
- "Connect to VMs without public IPs, from the browser" = Azure Bastion.
- "Use the local SSH client through Bastion" = Standard or Premium + native client support.
- "Minimum subnet size for Bastion" = /26.
Five quick revision questions
-
1.What must the Bastion subnet be called?Show
AzureBastionSubnet.
-
2.What is the minimum size of that subnet?Show
/26.
-
3.Which port does the admin use to reach Bastion?Show
TCP 443 (HTTPS).
-
4.Can Bastion connect to VMs in peered VNets?Show
Yes.
-
5.Which SKUs support native client connections?Show
Standard and Premium.
Official references
Finished this lesson? Tick it off. Your progress is saved in this browser.
Next up: Service Endpoints vs Private Endpoints for PaaS
Lesson done? Make it stick with a quick gameSort It, Match the Pairs, Lightning Round and Who Am I? Earn XP and badges.