You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/bastion/bastion-nsg.md
+12-5Lines changed: 12 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ ms.service: azure-bastion
6
6
ms.topic: concept-article
7
7
ms.date: 02/24/2026
8
8
ms.author: abell
9
-
# Customer intent: As a member of the SecOps team, I want to understand and configure network security groups for Azure Bastion, so that I can manage secure ingress and egress traffic to virtual machines while maintaining compliance and security practices. I want to understand the impact of not having the correct NSG rules in place from a security perspective.
9
+
# Customer intent: As a network administrator, I want to understand and configure network security groups for Azure Bastion, so that I can manage secure ingress and egress traffic to virtual machines while maintaining compliance and security practices. I want to understand the impact of not having the correct NSG rules in place from a security perspective. This is a procedural article.
10
10
---
11
11
# Configure NSG rules for Azure Bastion
12
12
@@ -24,14 +24,14 @@ In this diagram:
24
24
* Connect Integration - Single-click RDP/SSH session inside the browser
25
25
* No public IP is required on the Azure VM.
26
26
27
-
## <aname="nsg"></a>Network security groups
27
+
## <aname="nsg"></a>Setting up network security groups (NSG)
28
28
29
29
This section shows you the network traffic between the user and Azure Bastion, and through to target VMs in your virtual network:
30
30
31
31
> [!IMPORTANT]
32
32
> If you apply an NSG to your Azure Bastion resource, you **must** create all of the following ingress and egress traffic rules. Omitting any rule blocks your Bastion host from receiving platform updates and opens your deployment to future security vulnerabilities.
33
33
34
-
The following table summarizes all required NSG rules. Detailed explanations for each rule follow.
34
+
The following table summarizes all required NSG rules.
35
35
36
36
| Rule name | Direction | Source | Destination | Port(s) | Protocol |
37
37
|---|---|---|---|---|---|
@@ -44,6 +44,8 @@ The following table summarizes all required NSG rules. Detailed explanations for
Azure Bastion is deployed specifically to ***AzureBastionSubnet***.
@@ -74,8 +76,11 @@ This is the subnet that contains the target virtual machine that you want to con
74
76
75
77
***Ingress from AzureBastionSubnet (ports 3389, 22):** Open RDP/SSH ports (3389 and 22 respectively, or custom values if you use the custom port feature with Standard or Premium SKU) inbound on the target VM subnet over private IP. Without this rule, Bastion can't reach your VMs even when it's correctly configured. As a best practice, scope the source to the AzureBastionSubnet IP address range so that only Bastion can open these ports -- not the broader internet.
76
78
77
-
### PowerShell script to create NSG rules
78
-
```
79
+
### [PowerShell](#tab/powershell)
80
+
81
+
Use the following script to create all required NSG rules for Azure Bastion.
82
+
83
+
```azurepowershell
79
84
# Connect to Azure Account
80
85
Connect-AzAccount
81
86
# Get the Network Security Group details
@@ -189,6 +194,8 @@ foreach ($rule in $rules) {
189
194
}
190
195
```
191
196
197
+
---
198
+
192
199
## Next steps
193
200
194
201
* Learn how to [secure your Azure Bastion deployment](secure-bastion.md) using actionable guidance aligned to the Microsoft Cloud Security Benchmark.
0 commit comments