πŸ”’ Guided

Pre-launch preview. Authorised access only.

Incorrect code

Guided by A Guide to Cloud
Explore AB-900 AI-901
Guided AZ-140 Domain 2
Domain 2 β€” Module 4 of 5 80%
16 of 28 overall

AZ-140 Study Guide

Domain 1: Plan and Implement an AVD Infrastructure

  • AVD Architecture: The Big Picture Free
  • Network Capacity and Design Free
  • RDP Shortpath, Multipath and QoS Free
  • Private Link and Network Troubleshooting Free
  • Storage Planning for User Data Free
  • File Shares and Azure NetApp Files Free
  • Host Pool Architecture: Personal vs Pooled Free
  • Sizing for Performance and Capacity Free
  • Creating Host Pools and Session Hosts Free
  • Session Host Licensing Free
  • Building Session Host Images Free
  • Image Lifecycle and Compute Gallery Free

Domain 2: Plan and Implement Identity and Security

  • Identity Scenarios for AVD
  • RBAC, Conditional Access and SSO
  • Defending AVD with Microsoft Defender
  • Network Security: NSGs, Firewall, Bastion
  • Threat Protection and Confidential VMs

Domain 3: Plan and Implement User Environments and Apps

  • FSLogix Profile Containers and ODFC
  • FSLogix Cloud Cache and Application Masking
  • AVD Clients: Choose and Deploy
  • User Experience and Session Settings
  • Application Groups and RemoteApp
  • Microsoft 365, Teams and OneDrive on AVD
  • App Attach: Dynamic Application Delivery

Domain 4: Monitor and Maintain an AVD Infrastructure

  • Monitoring AVD with Azure Monitor
  • Autoscaling and Session Management
  • Update Strategy and Backups
  • Disaster Recovery and Multi-Region

AZ-140 Study Guide

Domain 1: Plan and Implement an AVD Infrastructure

  • AVD Architecture: The Big Picture Free
  • Network Capacity and Design Free
  • RDP Shortpath, Multipath and QoS Free
  • Private Link and Network Troubleshooting Free
  • Storage Planning for User Data Free
  • File Shares and Azure NetApp Files Free
  • Host Pool Architecture: Personal vs Pooled Free
  • Sizing for Performance and Capacity Free
  • Creating Host Pools and Session Hosts Free
  • Session Host Licensing Free
  • Building Session Host Images Free
  • Image Lifecycle and Compute Gallery Free

Domain 2: Plan and Implement Identity and Security

  • Identity Scenarios for AVD
  • RBAC, Conditional Access and SSO
  • Defending AVD with Microsoft Defender
  • Network Security: NSGs, Firewall, Bastion
  • Threat Protection and Confidential VMs

Domain 3: Plan and Implement User Environments and Apps

  • FSLogix Profile Containers and ODFC
  • FSLogix Cloud Cache and Application Masking
  • AVD Clients: Choose and Deploy
  • User Experience and Session Settings
  • Application Groups and RemoteApp
  • Microsoft 365, Teams and OneDrive on AVD
  • App Attach: Dynamic Application Delivery

Domain 4: Monitor and Maintain an AVD Infrastructure

  • Monitoring AVD with Azure Monitor
  • Autoscaling and Session Management
  • Update Strategy and Backups
  • Disaster Recovery and Multi-Region
Domain 2: Plan and Implement Identity and Security Premium ⏱ ~19 min read

Network Security: NSGs, Firewall, Bastion

Lock down your AVD session hosts with Network Security Groups, route traffic through Azure Firewall, and secure admin access with Azure Bastion and Just-in-Time VM access.

Network security for AVD β€” defence in depth

β˜• Simple explanation

Think of your AVD network like a gated estate.

  • NSGs are the gates on each house (subnet). They check a list: β€œIs this visitor allowed in? Is this resident allowed out?” Quick, simple, rule-based.
  • Azure Firewall is the estate security office at the main entrance. It inspects every visitor more thoroughly β€” checks IDs, scans packages, and logs everything. All traffic must pass through it.
  • UDRs (User-Defined Routes) are the road signs that force all traffic through the security office instead of taking a shortcut.
  • Azure Bastion is the estate manager’s private entrance. Admins use it to enter the estate securely over HTTPS without needing a public gate.
  • JIT VM access is a temporary visitor pass. The gate only opens for a set time, then locks again automatically.

AVD session hosts live in Azure Virtual Networks and communicate with the AVD control plane, identity providers, storage, and the internet. Each connection point is a potential attack surface that must be secured.

Defence in depth for AVD networking uses multiple layers:

  • Network Security Groups (NSGs) β€” stateful packet filtering at the subnet or NIC level
  • User-Defined Routes (UDRs) β€” force traffic through inspection points like Azure Firewall
  • Azure Firewall β€” centralised, managed firewall with application-layer filtering and FQDN-based rules
  • Azure Bastion β€” secure RDP/SSH access over HTTPS without exposing public IPs
  • Just-in-Time (JIT) VM access β€” time-limited NSG rules for admin access

Network Security Groups (NSGs)

NSGs are your first line of defence. They filter traffic at Layer 3/4 (IP addresses, ports, protocols) and are applied to subnets or individual NICs.

Recommended NSG rules for session host subnets

Inbound rules (what can reach session hosts):

PriorityNameSourcePortActionPurpose
100Allow-RDP-From-BastionAzureBastionSubnet3389AllowAdmin access via Bastion
200Allow-AVD-AgentAzureCloud443AllowAVD agent communication
4096Deny-All-InboundAnyAnyDenyBlock everything else

Outbound rules (what session hosts can reach):

PriorityNameDestinationPortActionPurpose
100Allow-AVD-ServiceWindowsVirtualDesktop (service tag)443AllowAVD control plane
200Allow-AzureCloudAzureCloud (service tag)443AllowAzure services (storage, monitor, KMS)
300Allow-DNSDNS servers53AllowName resolution
400Allow-KMS23.102.135.2461688AllowWindows activation
4096Deny-All-OutboundAnyAnyDenyBlock everything else

πŸ›οΈ JC starts locked down: β€œAt the Federal Department, our default posture is deny-all inbound and deny-all outbound. We then open only what is required. Aisha, our security auditor, reviews every NSG rule before it goes live.”

πŸ’‘ Exam tip: Service tags vs IP addresses

Always use Azure service tags (like WindowsVirtualDesktop, AzureCloud) instead of hardcoded IP addresses in NSG rules. Service tags are maintained by Microsoft and automatically update when IP ranges change. If the exam gives you a scenario where AVD stops working after Microsoft updates their IP ranges, the fix is to switch from hardcoded IPs to service tags.

User-Defined Routes (UDRs)

By default, Azure routes traffic directly between subnets and to the internet. UDRs override this default behaviour to force traffic through an inspection point.

Force-tunnelling through Azure Firewall

A common AVD pattern is to force all outbound traffic from session hosts through Azure Firewall:

  1. Create a route table associated with the session host subnet
  2. Add a default route (0.0.0.0/0) with the next hop set to the Azure Firewall private IP
  3. Azure Firewall inspects, logs, and filters all outbound traffic

Why force-tunnel?

  • Centralised logging of all outbound connections
  • Application-layer filtering (block specific URLs, allow only required FQDNs)
  • Compliance requirement for regulated industries

🏒 Raj at TerraStack uses UDRs: β€œOur compliance team requires that all internet traffic from session hosts passes through Azure Firewall. The UDR sends everything to the firewall, and Dmitri (our network engineer) maintains the allow list of FQDNs.”

Caution: When using UDRs with AVD, you must NOT force-tunnel traffic destined for the AVD control plane through an on-premises firewall that does not support the required endpoints. This breaks the reverse-connect transport.

ℹ️ Deep dive: Asymmetric routing warning

If you use UDRs to force-tunnel AVD traffic through Azure Firewall, be careful with the return path. The AVD Gateway sends traffic to session hosts via reverse connect (the session host initiates the outbound connection). If the UDR forces this traffic through the firewall but the return traffic takes a different path, you get asymmetric routing, which the firewall may drop.

To avoid this, ensure the UDR route table covers all traffic symmetrically, and that the firewall has rules allowing both directions of the AVD connection.

Azure Firewall for AVD

Azure Firewall provides centralised, stateful network and application-layer filtering.

FQDN tags β€” the easy button

Azure Firewall supports FQDN tags β€” pre-defined groups of FQDNs maintained by Microsoft. For AVD, the key tag is:

WindowsVirtualDesktop β€” includes all FQDNs required for the AVD control plane, agent updates, and service communication.

Using this FQDN tag means you do not need to manually maintain a list of dozens of AVD service URLs. Microsoft updates the tag automatically.

Required firewall rules for AVD

Rule TypeTargetPortPurpose
Application ruleFQDN tag: WindowsVirtualDesktop443AVD service endpoints
Application ruleFQDN tag: Windows Update (or WSUS)443OS and agent updates
Network rule169.254.169.25480Azure Instance Metadata Service
Network rule168.63.129.1680Azure health monitoring
Network rule23.102.135.2461688KMS activation for Windows
Application rulelogin.microsoftonline.com443Entra ID authentication
Application rule*.wvd.microsoft.com443AVD global and regional endpoints
NSG vs Azure Firewall
CapabilityNetwork Security GroupAzure Firewall
Filtering layerLayer 3/4 (IP, port, protocol)Layer 3-7 (includes FQDN, URL, application)
FQDN filteringNoYes β€” application rules and FQDN tags
Threat intelligenceNoYes β€” block known malicious IPs/domains
TLS inspectionNoYes (Premium SKU)
LoggingNSG flow logs (requires config)Built-in diagnostics and logging
CostFree (flow logs cost extra)Paid β€” hourly + data processing charges
ScopePer subnet or NICCentralised for entire VNet or hub
Best forBasic allow/deny at subnet levelCentralised inspection, compliance, FQDN control
Use together?Yes β€” NSGs are the first filter, Firewall is the deep inspectorYes β€” always use both for defence in depth

Best practice: Use NSGs AND Azure Firewall together. NSGs handle broad allow/deny at the subnet level. Azure Firewall handles granular FQDN filtering and logging. They complement each other.

Azure Bastion β€” secure admin access

Azure Bastion provides RDP and SSH connectivity to VMs over HTTPS through the Azure portal. No public IP addresses, no VPN, no exposed RDP ports.

How it works

  1. Bastion is deployed into a dedicated AzureBastionSubnet (/26 or larger) in the same VNet as your session hosts (or a peered VNet)
  2. Admin opens the Azure portal, navigates to the VM, and clicks β€œConnect via Bastion”
  3. Bastion establishes an RDP/SSH session over port 443 (HTTPS) β€” tunnelled through the Bastion gateway
  4. The session host needs NO public IP address and NO inbound RDP (3389) rule in the NSG

Bastion SKUs

FeatureBasicStandardPremium
Connect via Azure portalYesYesYes
Connect via native RDP clientNoYesYes
File transferNoYesYes
Shareable linkNoYesYes
Session recordingNoNoYes
Private-only deploymentNoYesYes

Just-in-Time (JIT) VM access

JIT is a feature of Defender for Cloud (Plan 2) that creates temporary NSG rules to allow admin access for a limited time.

How JIT works

  1. Admin requests access to a VM through Defender for Cloud (or the VM blade in the portal)
  2. JIT creates a temporary inbound NSG rule allowing RDP (3389) from the admin’s IP
  3. The rule has a time limit (e.g. 3 hours) β€” after expiry, JIT automatically removes the rule
  4. All access is logged for auditing
Azure Bastion vs JIT VM Access
AspectAzure BastionJIT VM Access
What it doesProvides RDP/SSH over HTTPS through a gatewayOpens a temporary NSG rule for RDP/SSH access
Public IP needed on VMNoNo (but admin connects directly via private IP or VPN)
Always availableYes β€” gateway is always runningNo β€” access must be requested each time
Time-limitedNo β€” session stays open as long as neededYes β€” NSG rule auto-expires after set duration
CostBastion gateway hourly costIncluded with Defender for Servers Plan 2
RequiresAzureBastionSubnet in VNetDefender for Cloud Plan 2 enabled
Best forDaily admin access, no VPN environmentsOccasional admin access, audit-heavy environments
Can be combinedYes β€” use Bastion for access, JIT for additional time-limitingYes β€” JIT can protect Bastion-accessed VMs too

πŸ›οΈ JC uses both: β€œAzure Bastion is our only way to RDP into session hosts β€” no public IPs, ever. But we also layer JIT on top. Even through Bastion, the NSG blocks RDP unless JC or Aisha request JIT access first. Belt and braces.”

πŸ’‘ Exam tip: Bastion + JIT together

Bastion and JIT are NOT mutually exclusive. You can use Bastion as the connectivity method (no public IPs, HTTPS tunnel) AND require JIT approval before the NSG allows the Bastion traffic to reach the VM. This is the most secure admin access pattern and is the answer the exam is looking for when maximum security is mentioned.

Network security architecture for AVD

A typical secure AVD network looks like this:

ComponentSubnetPurpose
Azure FirewallAzureFirewallSubnet (/26)Centralised traffic inspection
Azure BastionAzureBastionSubnet (/26)Secure admin access
Session hostsSessionHostSubnet (/24 or larger)User desktops
Domain controllers (if AD DS)IdentitySubnet (/27)Authentication
Storage (private endpoints)PrivateEndpointSubnet (/27)FSLogix profiles

UDR on SessionHostSubnet: 0.0.0.0/0 next hop to Azure Firewall. NSG on SessionHostSubnet: deny-all inbound, allow only required outbound. NSG on AzureBastionSubnet: allow 443 inbound from internet (required for Bastion to work).

Question

What is the Azure Firewall FQDN tag for AVD, and why should you use it?

Click or press Enter to reveal answer

Answer

The tag is 'WindowsVirtualDesktop'. It contains all FQDNs required for the AVD service. Use it instead of manually listing URLs because Microsoft maintains and updates it automatically when endpoints change.

Click to flip back

Question

What is the minimum subnet size for Azure Bastion?

Click or press Enter to reveal answer

Answer

/26 (64 IP addresses). The subnet MUST be named exactly 'AzureBastionSubnet'. A smaller subnet will fail deployment.

Click to flip back

Question

What does a UDR with 0.0.0.0/0 next hop Azure Firewall do?

Click or press Enter to reveal answer

Answer

It force-tunnels ALL outbound traffic from the subnet through Azure Firewall. This means every outbound connection from session hosts is inspected and logged by the firewall before reaching the internet.

Click to flip back

Question

What is JIT VM access and what Defender plan does it require?

Click or press Enter to reveal answer

Answer

JIT (Just-in-Time) creates temporary NSG rules that allow admin access (RDP/SSH) for a limited time, then auto-removes them. It requires Defender for Servers Plan 2.

Click to flip back

Knowledge Check

Raj's AVD session hosts suddenly cannot reach the AVD control plane after Microsoft updated their service IP ranges. The NSG outbound rules use hardcoded IP addresses for AVD endpoints. What should Raj do to prevent this from happening again?

Knowledge Check

JC needs the most secure admin access pattern for AVD session hosts. No public IPs, all access over HTTPS, and access must be time-limited with full audit logging. What should JC implement?

Knowledge Check

Dmitri is configuring Azure Firewall rules for TerraStack's AVD deployment. Which single rule most efficiently allows all required AVD control plane traffic?

🎬 Video coming soon

Network Security: NSGs, Firewall, Bastion


Next up: Threat Protection and Confidential VMs β€” how to lock down applications with WDAC, protect against ransomware with Controlled Folder Access, and secure VMs with Trusted Launch and confidential computing.

← Previous

Defending AVD with Microsoft Defender

Next β†’

Threat Protection and Confidential VMs

Guided

I learn, I simplify, I share.

A Guide to Cloud YouTube Feedback

© 2026 Sutheesh. All rights reserved.

Guided is an independent study resource and is not affiliated with, endorsed by, or officially connected to Microsoft. Microsoft, Azure, and related trademarks are property of Microsoft Corporation. Always verify information against Microsoft Learn.