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/network-watcher/network-watcher-nsg-auditing-powershell.md
+18-16Lines changed: 18 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,35 +1,37 @@
1
1
---
2
-
title: Automate NSG auditing - Security group view
2
+
title: Automate NSG auditing with security group view
3
3
titleSuffix: Azure Network Watcher
4
4
description: This page provides instructions on how to configure auditing of a Network Security Group
5
5
services: network-watcher
6
6
author: halkazwini
7
7
ms.service: network-watcher
8
8
ms.topic: how-to
9
9
ms.workload: infrastructure-services
10
-
ms.date: 03/01/2022
10
+
ms.date: 03/28/2023
11
11
ms.author: halkazwini
12
-
ms.custom: engagement-fy23
12
+
ms.custom: template-how-to, engagement-fy23
13
13
---
14
14
15
-
# Automate NSG auditing with Azure Network Watcher Security group view
15
+
# Automate NSG auditing with Azure Network Watcher security group view
16
16
17
-
Customers are often faced with the challenge of verifying the security posture of their infrastructure. This challenge is no different for their VMs in Azure. It is important to have a similar security profile based on the Network Security Group (NSG) rules applied. Using the Security Group View, you can now get the list of rules applied to a VM within an NSG. You can define a golden NSG security profile and initiate Security Group View on a weekly cadence and compare the output to the golden profile and create a report. This way you can identify with ease all the VMs that do not conform to the prescribed security profile.
17
+
> [!NOTE]
18
+
> The security group view API is no longer being maintained and will be deprecated soon. Please use the [Effective security rules feature](./network-watcher-security-group-view-overview.md) which provides the same functionality.
18
19
19
-
If you are unfamiliar with Network Security Groups, see [Network Security Overview](../virtual-network/network-security-groups-overview.md).
20
+
Customers are often faced with the challenge of verifying the security posture of their infrastructure. This challenge is no different for their VMs in Azure. It's important to have a similar security profile based on the Network Security Group (NSG) rules applied. Using the Security Group View, you can now get the list of rules applied to a VM within an NSG. You can define a golden NSG security profile and initiate Security Group View on a weekly cadence and compare the output to the golden profile and create a report. This way you can identify with ease all the VMs that don't conform to the prescribed security profile.
20
21
22
+
To learn more about network security groups, see [Network security groups overview](../virtual-network/network-security-groups-overview.md).
In this scenario, you compare a known good baseline to the security group view results returned for a virtual machine.
28
+
- If you don't have an Azure account with an active subscription, [create one for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
29
+
- A virtual machine (VM).
27
30
28
-
This scenario assumes you have already followed the steps in [Create a Network Watcher](network-watcher-create.md) to create a Network Watcher. The scenario also assumes that a Resource Group with a valid virtual machine exists to be used.
29
31
30
32
## Scenario
31
33
32
-
The scenario covered in this article gets the security group view for a virtual machine.
34
+
In this scenario, you compare a known good baseline to the security group view results returned for a virtual machine.
33
35
34
36
In this scenario, you will:
35
37
@@ -109,7 +111,7 @@ The first step in this example is to work with an existing baseline. The followi
109
111
110
112
## Convert rule set to PowerShell objects
111
113
112
-
In this step, we are reading a json file that was created earlier with the rules that are expected to be on the Network Security Group for this example.
114
+
In this step, we're reading a json file that was created earlier with the rules that are expected to be on the Network Security Group for this example.
The response is grouped by Network interfaces. The different types of rules returned are effective and default security rules. The result is further broken down by how it is applied, either on a subnet or a virtual NIC.
146
+
The response is grouped by Network interfaces. The different types of rules returned are effective and default security rules. The result is further broken down by how it's applied, either on a subnet or a virtual NIC.
145
147
146
148
The following PowerShell script compares the results of the Security Group View to an existing output of an NSG. The following example is a simple example of how the results can be compared with `Compare-Object` cmdlet.
The following example is the result. You can see two of the rules that were in the first rule set were not present in the comparison.
156
+
The following example is the result. You can see two of the rules that were in the first rule set weren't present in the comparison.
155
157
156
158
```
157
159
Name : My2ndRuleDoNotDelete
@@ -181,4 +183,4 @@ SideIndicator : <=
181
183
182
184
## Next steps
183
185
184
-
If settings have been changed, see [Manage Network Security Groups](../virtual-network/manage-network-security-group.md) to track down the network security group and security rules that are in question.
186
+
See [Create, change, or delete a network security group](../virtual-network/manage-network-security-group.md) to track down the network security group and security rules that are in question.
0 commit comments