Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Azure Bastion for secure VM access
📖 Scenario: You are managing a small company's Azure cloud environment. You want to securely connect to a virtual machine (VM) without exposing it to the public internet. Azure Bastion provides a secure way to access VMs through the Azure portal using SSL without needing a public IP on the VM.
🎯 Goal: Build an Azure Bastion host setup that allows secure RDP/SSH access to a VM inside a virtual network without exposing the VM to the internet.
📋 What You'll Learn
Create a virtual network with a subnet for Azure Bastion
Create an Azure Bastion resource in the Bastion subnet
Create a virtual machine inside the virtual network
Configure the VM to be accessible only through Azure Bastion
💡 Why This Matters
🌍 Real World
Azure Bastion is used in real companies to securely manage virtual machines without exposing them to the internet, reducing security risks.
💼 Career
Cloud engineers and administrators use Azure Bastion to provide secure remote access to VMs, a common task in cloud infrastructure management.
Progress0 / 4 steps
1
Create a virtual network with a Bastion subnet
Create a virtual network called myVnet with address space 10.0.0.0/16. Inside it, create a subnet called AzureBastionSubnet with address prefix 10.0.1.0/24. Use Azure CLI commands exactly as shown.
Azure
Hint
Use az network vnet create with the --subnet-name and --subnet-prefix options to create the Bastion subnet.
2
Create the Azure Bastion host
Create an Azure Bastion host called myBastionHost in the resource group myResourceGroup inside the virtual network myVnet. Use the subnet AzureBastionSubnet and assign a public IP called myBastionIP with SKU Standard. Use Azure CLI commands exactly as shown.
Azure
Hint
Create a public IP with az network public-ip create before creating the Bastion host with az network bastion create.
3
Create a virtual machine inside the virtual network
Create a virtual machine called myVM in resource group myResourceGroup inside the virtual network myVnet and subnet default. Use UbuntuLTS image, admin username azureuser, and disable public IP assignment. Use Azure CLI commands exactly as shown.
Azure
Hint
Use --public-ip-address "" to disable public IP on the VM.
4
Connect to the VM securely using Azure Bastion
Add a tag called Access with value AzureBastion to the virtual machine myVM to indicate it should be accessed only via Azure Bastion. Use Azure CLI commands exactly as shown.
Azure
Hint
Use az vm update with --set tags.Access=AzureBastion to add the tag.
Practice
(1/5)
1. What is the main purpose of Azure Bastion when accessing virtual machines (VMs)?
easy
A. To backup VM data to Azure storage
B. To create public IP addresses for all VMs automatically
C. To replace virtual networks with a simpler network
D. To provide secure, browser-based access to VMs without exposing public IP addresses
Solution
Step 1: Understand Azure Bastion's role
Azure Bastion allows users to connect to VMs securely through a browser without needing a public IP on the VM.
Step 2: Compare options with this role
Only To provide secure, browser-based access to VMs without exposing public IP addresses describes this secure, browser-based access without public IP exposure.
Final Answer:
To provide secure, browser-based access to VMs without exposing public IP addresses -> Option D
Quick Check:
Azure Bastion = Secure browser access without public IP [OK]
Hint: Azure Bastion hides VM public IPs for secure browser access [OK]
Common Mistakes:
Thinking Azure Bastion creates public IPs for VMs
Confusing Azure Bastion with backup services
Assuming it replaces virtual networks
2. Which subnet name is required to deploy Azure Bastion correctly?
A. Fails because the subnet AzureBastionSubnet is missing in MyVNet
B. Creates a VM named MyBastionHost instead of a Bastion host
C. Creates an Azure Bastion host named MyBastionHost in MyResourceGroup using MyPublicIP and MyVNet
D. Creates a public IP named MyBastionHost
Solution
Step 1: Check prerequisites for Azure Bastion creation
Azure Bastion requires a subnet named 'AzureBastionSubnet' in the specified virtual network before creation.
Step 2: Analyze command and subnet presence
If the subnet AzureBastionSubnet exists in MyVNet, the command will successfully create the Bastion host.
Final Answer:
Creates an Azure Bastion host named MyBastionHost in MyResourceGroup using MyPublicIP and MyVNet -> Option C
Quick Check:
Azure Bastion host created if subnet exists [OK]
Hint: Azure Bastion needs AzureBastionSubnet before creation [OK]
Common Mistakes:
Assuming the command creates the subnet automatically
Confusing Bastion host with VM creation
Thinking public IP is created with Bastion host name
4. You deployed Azure Bastion but cannot connect to your VM through the Azure portal. What is the most likely cause?
medium
A. The AzureBastionSubnet is smaller than /27
B. The VM is in a different virtual network than the Bastion host
C. The VM has a public IP address assigned
D. The Bastion host is deployed in the same subnet as the VM
Solution
Step 1: Understand Bastion host and VM network relationship
Azure Bastion must be deployed in the same virtual network as the VM to allow secure access.
Step 2: Analyze options for connectivity issues
If the VM is in a different virtual network, Bastion cannot connect to it, causing failure.
Final Answer:
The VM is in a different virtual network than the Bastion host -> Option B
Quick Check:
VM and Bastion must share the same VNet [OK]
Hint: Bastion and VM must be in the same virtual network [OK]
Common Mistakes:
Assigning public IP to VM does not block Bastion access
Thinking subnet size smaller than /27 causes failure
Deploying Bastion in VM subnet is not allowed
5. You want to secure access to multiple VMs in different subnets within the same virtual network using Azure Bastion. Which configuration is required?
hard
A. Deploy one Azure Bastion host in a dedicated AzureBastionSubnet in the virtual network; no public IPs needed on VMs
B. Deploy an Azure Bastion host in each subnet where VMs are located
C. Assign public IPs to all VMs and connect directly without Bastion
D. Deploy Azure Bastion in a separate virtual network and peer it with VM networks
Solution
Step 1: Understand Azure Bastion scope within a virtual network
One Azure Bastion host per virtual network can provide secure access to all VMs in any subnet within that network.
Step 2: Evaluate options for multi-subnet VM access
Deploy one Azure Bastion host in a dedicated AzureBastionSubnet in the virtual network; no public IPs needed on VMs correctly states deploying one Bastion host in the required subnet with no public IPs on VMs.
Final Answer:
Deploy one Azure Bastion host in a dedicated AzureBastionSubnet in the virtual network; no public IPs needed on VMs -> Option A
Quick Check:
One Bastion per VNet secures all subnets [OK]
Hint: One Bastion host per VNet secures all subnets [OK]
Common Mistakes:
Deploying Bastion in every subnet wastes resources
Assigning public IPs defeats Bastion's purpose
Trying to peer Bastion in separate VNet for access