Skip to content

Commit a32f77c

Browse files
authored
Merge pull request #290607 from paulth1/virtual-network-planning-configuring
[AQ] edit pass: Virtual network planning configuring
2 parents 42738fb + a1ca4ef commit a32f77c

6 files changed

+262
-265
lines changed

articles/virtual-network/virtual-network-nsg-manage-log.md

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ A network security group (NSG) includes rules that allow or deny traffic to a vi
1919

2020
When you enable logging for an NSG, you can gather the following types of resource log information:
2121

22-
- **Event:** Entries are logged for which NSG rules are applied to virtual machines, based on MAC address.
23-
- **Rule counter:** Contains entries for how many times each NSG rule is applied to allow or deny traffic. The status for these rules is collected every 300 seconds.
22+
- **Event**: Entries are logged for which NSG rules are applied to virtual machines, based on a MAC address.
23+
- **Rule counter**: Contains entries for how many times each NSG rule is applied to allow or deny traffic. The status for these rules is collected every 300 seconds.
2424

25-
Resource logs are only available for NSGs deployed through the Azure Resource Manager deployment model. You can't enable resource logging for NSGs deployed through the classic deployment model. For more information, see [Understand deployment models](../azure-resource-manager/management/deployment-models.md).
25+
Resource logs are available only for NSGs deployed through the Azure Resource Manager deployment model. You can't enable resource logging for NSGs deployed through the classic deployment model. For more information, see [Understand deployment models](../azure-resource-manager/management/deployment-models.md).
2626

2727
Resource logging is enabled separately for *each* NSG for which to collect diagnostic data. If you're interested in *activity*, or *operational*, logs instead, see [Overview of Azure platform logs](/azure/azure-monitor/essentials/platform-logs-overview). If you're interested in IP traffic flowing through NSGs, see [Flow logs for network security groups](../network-watcher/network-watcher-nsg-flow-logging-overview.md).
2828

@@ -32,21 +32,21 @@ You can use the [Azure portal](#azure-portal), [Azure PowerShell](#azure-powersh
3232

3333
### Azure portal
3434

35-
1. Sign in to [the Azure portal](https://portal.azure.com).
36-
1. In the search box at the top of the Azure portal, enter *network security groups*. Select **Network security groups** in the search results.
37-
1. Select the NSG for which to enable logging.
38-
1. Under **Monitoring**, select **Diagnostic settings**, and then select **Add diagnostic setting**:
35+
1. Sign in to the [Azure portal](https://portal.azure.com).
36+
1. In the search box at the top of the Azure portal, enter **network security groups**. Select **Network security groups** in the search results.
37+
1. Select the NSG for which you want to enable logging.
38+
1. Under **Monitoring**, select **Diagnostic settings**, and then select **Add diagnostic setting**.
3939

40-
:::image type="content" source="./media/virtual-network-nsg-manage-log/turn-on-diagnostics.png" alt-text="Screenshot shows the diagnostic settings for an NSG with Add diagnostic setting highlighted." lightbox="./media/virtual-network-nsg-manage-log/turn-on-diagnostics.png":::
40+
:::image type="content" source="./media/virtual-network-nsg-manage-log/turn-on-diagnostics.png" alt-text="Screenshot that shows the diagnostic settings for an NSG with Add diagnostic setting highlighted." lightbox="./media/virtual-network-nsg-manage-log/turn-on-diagnostics.png":::
4141

42-
1. In **Diagnostic setting**, enter a name, such as *myNsgDiagnostic*.
42+
1. In **Diagnostic setting**, enter a name, such as **myNsgDiagnostic**.
4343
1. For **Logs**, select **allLogs** or select individual categories of logs. For more information about each category, see [Log categories](#log-categories).
4444
1. Under **Destination details**, select one or more destinations:
4545

46-
- Send to Log Analytics workspace
47-
- Archive to a storage account
48-
- Stream to an event hub
49-
- Send to partner solution
46+
- Send to a Log Analytics workspace.
47+
- Archive to a storage account.
48+
- Stream to an event hub.
49+
- Send to a partner solution.
5050

5151
For more information, see [Log destinations](#log-destinations).
5252

@@ -58,23 +58,23 @@ You can use the [Azure portal](#azure-portal), [Azure PowerShell](#azure-powersh
5858

5959
[!INCLUDE [updated-for-az](~/reusable-content/ce-skilling/azure/includes/updated-for-az.md)]
6060

61-
You can run the commands that in this section in the [Azure Cloud Shell](https://shell.azure.com/powershell), or by running PowerShell from your computer. The Azure Cloud Shell is a free interactive shell. It has common Azure tools preinstalled and configured to use with your account.
61+
You can run the commands that are available in this section in [Azure Cloud Shell](https://shell.azure.com/powershell). You can also run PowerShell from your computer. Cloud Shell is a free interactive shell. It has common Azure tools preinstalled and configured to use with your account.
6262

6363
If you run PowerShell from your computer, you need the Azure PowerShell module, version 1.0.0 or later. Run `Get-Module -ListAvailable Az` to find the installed version. If you need to upgrade, see [Install Azure PowerShell module](/powershell/azure/install-azure-powershell). If you run PowerShell locally, you also need to run the [Connect-AzAccount](/powershell/module/az.accounts/connect-azaccount) cmdlet to sign in to Azure with an account that has the [necessary permissions](virtual-network-network-interface.md#permissions).
6464

6565
To enable resource logging, you need the ID of an existing NSG. If you don't have an existing NSG, create one by using the [New-AzNetworkSecurityGroup](/powershell/module/az.network/new-aznetworksecuritygroup) cmdlet.
6666

67-
Get the network security group that you want to enable resource logging for by using the [Get-AzNetworkSecurityGroup](/powershell/module/az.network/get-aznetworksecuritygroup) cmdlet. Store the NSG in a variable for later use. For example, to retrieve an NSG named *myNsg* that exists in a resource group named *myResourceGroup*, enter the following command:
67+
Get the NSG for which you want to enable resource logging by using the [Get-AzNetworkSecurityGroup](/powershell/module/az.network/get-aznetworksecuritygroup) cmdlet. Store the NSG in a variable for later use. For example, to retrieve an NSG named `myNsg` that exists in a resource group named `myResourceGroup`, enter the following command:
6868

6969
```azurepowershell-interactive
7070
$Nsg=Get-AzNetworkSecurityGroup `
7171
-Name myNsg `
7272
-ResourceGroupName myResourceGroup
7373
```
7474

75-
You can write resource logs to different destination types. For more information, see [Log destinations](#log-destinations). In this article, logs are sent to a *Log Analytics workspace* destination. If you don't have an existing workspace, you can create one by using the [New-AzOperationalInsightsWorkspace](/powershell/module/az.operationalinsights/new-azoperationalinsightsworkspace) cmdlet.
75+
You can write resource logs to different destination types. For more information, see [Log destinations](#log-destinations). In this article, logs are sent to a *Log Analytics workspace* destination. If you don't have an existing workspace, create one by using the [New-AzOperationalInsightsWorkspace](/powershell/module/az.operationalinsights/new-azoperationalinsightsworkspace) cmdlet.
7676

77-
Retrieve an existing Log Analytics workspace with the [Get-AzOperationalInsightsWorkspace](/powershell/module/az.operationalinsights/get-azoperationalinsightsworkspace) cmdlet. For example, to get and store an existing workspace named *myWorkspace* in a resource group named *myWorkspaces*, enter the following command:
77+
Retrieve an existing Log Analytics workspace with the [Get-AzOperationalInsightsWorkspace](/powershell/module/az.operationalinsights/get-azoperationalinsightsworkspace) cmdlet. For example, to get and store an existing workspace named `myWorkspace` in a resource group named `myWorkspaces`, enter the following command:
7878

7979
```azurepowershell-interactive
8080
$Oms=Get-AzOperationalInsightsWorkspace `
@@ -99,13 +99,13 @@ View and analyze logs. For more information, see [View and analyze logs](#view-a
9999

100100
### Azure CLI
101101

102-
You can run the commands in this section in the [Azure Cloud Shell](https://shell.azure.com/bash), or by running the Azure CLI from your computer. The Azure Cloud Shell is a free interactive shell. It has common Azure tools preinstalled and configured to use with your account.
102+
You can run the commands in this section in [Cloud Shell](https://shell.azure.com/bash) or by running the Azure CLI from your computer. Cloud Shell is a free interactive shell. It has common Azure tools preinstalled and configured to use with your account.
103103

104-
If you run the CLI from your computer, you need version 2.0.38 or later. Run `az --version` on your computer, to find the installed version. If you need to upgrade, see [Install Azure CLI](/cli/azure/install-azure-cli). If you run the CLI locally, you also need to run `az login` to sign in to Azure with an account that has the [necessary permissions](virtual-network-network-interface.md#permissions).
104+
If you run the CLI from your computer, you need version 2.0.38 or later. Run `az --version` on your computer to find the installed version. If you need to upgrade, see [Install the Azure CLI](/cli/azure/install-azure-cli). If you run the CLI locally, you also need to run `az login` to sign in to Azure with an account that has the [necessary permissions](virtual-network-network-interface.md#permissions).
105105

106106
To enable resource logging, you need the ID of an existing NSG. If you don't have an existing NSG, create one by using [az network nsg create](/cli/azure/network/nsg#az-network-nsg-create).
107107

108-
Get and store the network security group that you want to enable resource logging for with [az network nsg show](/cli/azure/network/nsg#az-network-nsg-show). For example, to retrieve an NSG named *myNsg* that exists in a resource group named *myResourceGroup*, enter the following command:
108+
Get and store the NSG for which you want to enable resource logging with [az network nsg show](/cli/azure/network/nsg#az-network-nsg-show). For example, to retrieve an NSG named `myNsg` that exists in a resource group named `myResourceGroup`, enter the following command:
109109

110110
```azurecli-interactive
111111
nsgId=$(az network nsg show \
@@ -115,9 +115,9 @@ nsgId=$(az network nsg show \
115115
--output tsv)
116116
```
117117

118-
You can write resource logs to different destination types. For more information, see [Log destinations](#log-destinations). In this article, logs are sent to a *Log Analytics workspace* destination, as an example. For more information, see [Log categories](#log-categories).
118+
You can write resource logs to different destination types. For more information, see [Log destinations](#log-destinations). In this article, logs are sent to a Log Analytics workspace destination, as an example. For more information, see [Log categories](#log-categories).
119119

120-
Enable resource logging for the NSG with [az monitor diagnostic-settings create](/cli/azure/monitor/diagnostic-settings#az-monitor-diagnostic-settings-create). The following example logs both event and counter category data to an existing workspace named *myWorkspace*, which exists in a resource group named *myWorkspaces*. It uses the ID of the NSG that you saved by using the previous command.
120+
Enable resource logging for the NSG with [az monitor diagnostic-settings create](/cli/azure/monitor/diagnostic-settings#az-monitor-diagnostic-settings-create). The following example logs both event and counter category data to an existing workspace named `myWorkspace`, which exists in a resource group named `myWorkspaces`. It uses the ID of the NSG that you saved by using the previous command.
121121

122122
```azurecli-interactive
123123
az monitor diagnostic-settings create \
@@ -128,7 +128,7 @@ az monitor diagnostic-settings create \
128128
--resource-group myWorkspaces
129129
```
130130

131-
If you don't have an existing workspace, create one using the [Azure portal](/azure/azure-monitor/logs/quick-create-workspace) or [Azure PowerShell](/powershell/module/az.operationalinsights/new-azoperationalinsightsworkspace). There are two categories of logging for which you can enable logs.
131+
If you don't have an existing workspace, create one by using the [Azure portal](/azure/azure-monitor/logs/quick-create-workspace) or [Azure PowerShell](/powershell/module/az.operationalinsights/new-azoperationalinsightsworkspace). There are two categories of logging for which you can enable logs.
132132

133133
If you only want to log data for one category or the other, remove the category you don't want to log data for in the previous command. If you want to log to a different [destination](#log-destinations) than a Log Analytics workspace, use an appropriate parameter. For more information, see [Azure resource logs](/azure/azure-monitor/essentials/resource-logs).
134134

@@ -149,7 +149,7 @@ JSON-formatted data is written for the following log categories: event and rule
149149

150150
### Event
151151

152-
The event log contains information about which NSG rules are applied to virtual machines, based on MAC address. The following data is logged for each event. In the following example, the data is logged for a virtual machine with the IP address 192.168.1.4 and a MAC address of 00-0D-3A-92-6A-7C:
152+
The event log contains information about which NSG rules are applied to virtual machines, based on a MAC address. The following data is logged for each event. In the following example, the data is logged for a virtual machine with the IP address 192.168.1.4 and a MAC address of 00-0D-3A-92-6A-7C.
153153

154154
```json
155155
{
@@ -180,7 +180,7 @@ The event log contains information about which NSG rules are applied to virtual
180180

181181
### Rule counter
182182

183-
The rule counter log contains information about each rule applied to resources. The following example data is logged each time a rule is applied. In the following example, the data is logged for a virtual machine with the IP address 192.168.1.4 and a MAC address of 00-0D-3A-92-6A-7C:
183+
The rule counter log contains information about each rule applied to resources. The following example data is logged each time a rule is applied. In the following example, the data is logged for a virtual machine with the IP address 192.168.1.4 and a MAC address of 00-0D-3A-92-6A-7C.
184184

185185
```json
186186
{
@@ -203,29 +203,29 @@ The rule counter log contains information about each rule applied to resources.
203203
```
204204

205205
> [!NOTE]
206-
> The source IP address for the communication is not logged. You can enable [NSG flow logging](../network-watcher/network-watcher-nsg-flow-logging-portal.md) for an NSG, which logs all of the rule counter information and the source IP address that initiated the communication. NSG flow log data is written to an Azure Storage account. You can analyze the data with the [traffic analytics](../network-watcher/traffic-analytics.md) capability of Azure Network Watcher.
206+
> The source IP address for the communication isn't logged. You can enable [NSG flow logging](../network-watcher/network-watcher-nsg-flow-logging-portal.md) for an NSG, which logs all of the rule counter information and the source IP address that initiated the communication. NSG flow log data is written to an Azure Storage account. You can analyze the data with the [traffic analytics](../network-watcher/traffic-analytics.md) capability of Azure Network Watcher.
207207
208208
## View and analyze logs
209209

210210
If you send diagnostics data to:
211211

212-
- **Azure Monitor logs**: You can use the [network security group analytics](/azure/azure-monitor/insights/azure-networking-analytics?toc=%2fazure%2fvirtual-network%2ftoc.json) solution for enhanced insights. The solution provides visualizations for NSG rules that allow or deny traffic, per MAC address, of the network interface in a virtual machine.
212+
- **Azure Monitor logs**: You can use the [NSG analytics](/azure/azure-monitor/insights/azure-networking-analytics?toc=%2fazure%2fvirtual-network%2ftoc.json) solution for enhanced insights. The solution provides visualizations for NSG rules that allow or deny traffic, per MAC address, of the network interface in a virtual machine.
213213
- **Azure Storage account**: Data is written to a *PT1H.json* file. You can find the:
214214

215-
- Event log that is in the following path: *insights-logs-networksecuritygroupevent/resourceId=/SUBSCRIPTIONS/[ID]/RESOURCEGROUPS/[RESOURCE-GROUP-NAME-FOR-NSG]/PROVIDERS/MICROSOFT.NETWORK/NETWORKSECURITYGROUPS/[NSG NAME]/y=[YEAR]/m=[MONTH/d=[DAY]/h=[HOUR]/m=[MINUTE]*
216-
- Rule counter log that is in the following path: *insights-logs-networksecuritygrouprulecounter/resourceId=/SUBSCRIPTIONS/[ID]/RESOURCEGROUPS/[RESOURCE-GROUP-NAME-FOR-NSG]/PROVIDERS/MICROSOFT.NETWORK/NETWORKSECURITYGROUPS/[NSG NAME]/y=[YEAR]/m=[MONTH/d=[DAY]/h=[HOUR]/m=[MINUTE]*
215+
- Event log that's in the following path: *insights-logs-networksecuritygroupevent/resourceId=/SUBSCRIPTIONS/[ID]/RESOURCEGROUPS/[RESOURCE-GROUP-NAME-FOR-NSG]/PROVIDERS/MICROSOFT.NETWORK/NETWORKSECURITYGROUPS/[NSG NAME]/y=[YEAR]/m=[MONTH/d=[DAY]/h=[HOUR]/m=[MINUTE]*
216+
- Rule counter log that's in the following path: *insights-logs-networksecuritygrouprulecounter/resourceId=/SUBSCRIPTIONS/[ID]/RESOURCEGROUPS/[RESOURCE-GROUP-NAME-FOR-NSG]/PROVIDERS/MICROSOFT.NETWORK/NETWORKSECURITYGROUPS/[NSG NAME]/y=[YEAR]/m=[MONTH/d=[DAY]/h=[HOUR]/m=[MINUTE]*
217217

218218
To learn how to view resource log data, see [Azure platform logs overview](/azure/azure-monitor/essentials/platform-logs-overview).
219219

220-
## Next steps
220+
## Related content
221221

222-
- For more information about Activity logging, see [Overview of Azure platform logs](/azure/azure-monitor/essentials/platform-logs-overview).
222+
- For more information about activity logging, see [Overview of Azure platform logs](/azure/azure-monitor/essentials/platform-logs-overview).
223223

224224
Activity logging is enabled by default for NSGs created through either Azure deployment model. To determine which operations were completed on NSGs in the activity log, look for entries that contain the following resource types:
225225

226-
- Microsoft.ClassicNetwork/networkSecurityGroups
227-
- Microsoft.ClassicNetwork/networkSecurityGroups/securityRules
228-
- Microsoft.Network/networkSecurityGroups
229-
- Microsoft.Network/networkSecurityGroups/securityRules
226+
- `Microsoft.ClassicNetwork/networkSecurityGroups`
227+
- `Microsoft.ClassicNetwork/networkSecurityGroups/securityRules`
228+
- `Microsoft.Network/networkSecurityGroups`
229+
- `Microsoft.Network/networkSecurityGroups/securityRules`
230230

231-
- To learn how to log diagnostic information, see [Log network traffic to and from a virtual machine using the Azure portal](../network-watcher/network-watcher-nsg-flow-logging-portal.md).
231+
- To learn how to log diagnostic information, see [Log network traffic to and from a virtual machine by using the Azure portal](../network-watcher/network-watcher-nsg-flow-logging-portal.md).

0 commit comments

Comments
 (0)