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/nsg-flow-logs-tutorial.md
+19-27Lines changed: 19 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,13 @@
1
1
---
2
2
title: 'Tutorial: Log network traffic flow to and from a virtual machine'
3
3
titleSuffix: Azure Network Watcher
4
-
description: Learn how to log network traffic flow to and from a virtual machine (VM) using Network Watcher NSG flow logs capability.
4
+
description: In this tutorial, you learn how to log network traffic flow to and from a virtual machine (VM) using Network Watcher NSG flow logs capability.
# Customer intent: I need to log the network traffic to and from a virtual machine (VM) so I can analyze it for anomalies.
9
+
ms.date: 09/26/2023
10
+
# CustomerIntent: As an Azure administrator, I need to log the network traffic to and from a virtual machine (VM) so I can analyze the data for anomalies.
12
11
---
13
12
14
13
# Tutorial: Log network traffic to and from a virtual machine using the Azure portal
@@ -17,6 +16,8 @@ Network security group flow logging is a feature of Azure Network Watcher that a
17
16
18
17
This tutorial helps you use NSG flow logs to log a virtual machine's network traffic that flows through the [network security group](../virtual-network/network-security-groups-overview.md) associated to its network interface.
19
18
19
+
:::image type="content" source="./media/nsg-flow-logs-tutorial/nsg-flow-logs-tutorial-diagram.png" alt-text="Diagram shows the resources created during the tutorial.":::
20
+
20
21
In this tutorial, you learn how to:
21
22
22
23
> [!div class="checklist"]
@@ -31,17 +32,15 @@ In this tutorial, you learn how to:
31
32
32
33
- An Azure account with an active subscription. If you don't have one, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
33
34
34
-
## Sign in to Azure
35
-
36
-
Sign in to the [Azure portal](https://portal.azure.com).
37
-
38
35
## Create a virtual network
39
36
40
37
In this section, you create **myVNet** virtual network with one subnet for the virtual machine.
41
38
39
+
1. Sign in to the [Azure portal](https://portal.azure.com).
40
+
42
41
1. In the search box at the top of the portal, enter *virtual networks*. Select **Virtual networks** from the search results.
43
42
44
-
:::image type="content" source="./media/network-watcher-nsg-flow-logging-portal/virtual-network-azure-portal.png" alt-text="Screenshot shows searching for virtual networks in the Azure portal.":::
43
+
:::image type="content" source="./media/nsg-flow-logs-tutorial/virtual-network-azure-portal.png" alt-text="Screenshot shows searching for virtual networks in the Azure portal.":::
45
44
46
45
1. Select **+ Create**. In **Create virtual network**, enter or select the following values in the **Basics** tab:
47
46
@@ -128,7 +127,7 @@ NSG flow logging requires the **Microsoft.Insights** provider. To check its stat
128
127
129
128
1. Confirm the status of the provider displayed is **Registered**. If the status is **NotRegistered**, select the **Microsoft.Insights** provider then select **Register**.
130
129
131
-
:::image type="content" source="./media/network-watcher-nsg-flow-logging-portal/register-microsoft-insights.png" alt-text="Screenshot of registering Microsoft Insights provider in the Azure portal.":::
130
+
:::image type="content" source="./media/nsg-flow-logs-tutorial/register-microsoft-insights.png" alt-text="Screenshot of registering Microsoft Insights provider in the Azure portal.":::
132
131
133
132
## Create a storage account
134
133
@@ -163,7 +162,7 @@ In this section, you create an NSG flow log that's saved into the storage accoun
163
162
164
163
1. In **Network Watcher | Flow logs**, select **+ Create** or **Create flow log** blue button.
165
164
166
-
:::image type="content" source="./media/network-watcher-nsg-flow-logging-portal/flow-logs.png" alt-text="Screenshot of Flow logs page in the Azure portal." lightbox="./media/network-watcher-nsg-flow-logging-portal/flow-logs.png":::
165
+
:::image type="content" source="./media/nsg-flow-logs-tutorial/flow-logs.png" alt-text="Screenshot of Flow logs page in the Azure portal." lightbox="./media/nsg-flow-logs-tutorial/flow-logs.png":::
167
166
168
167
1. Enter or select the following values in **Create a flow log**:
169
168
@@ -172,13 +171,13 @@ In this section, you create an NSG flow log that's saved into the storage accoun
172
171
|**Project details**||
173
172
| Subscription | Select the Azure subscription of your network security group that you want to log. |
| Flow Log Name | Leave the default of **myVM-nsg-myResourceGroup-flowlog**.
174
+
| Flow Log Name | Leave the default of **myVM-nsg-myResourceGroup-flowlog**.|
176
175
|**Instance details**||
177
176
| Subscription | Select the Azure subscription of your storage account. |
178
177
| Storage Accounts | Select the storage account you created in the previous steps. This tutorial uses **mynwstorageaccount**. |
179
178
| Retention (days) | Enter *0* to retain the flow logs data in the storage account forever (until you delete it from the storage account). To apply a retention policy, enter the retention time in days. For information about storage pricing, see [Azure Storage pricing](https://azure.microsoft.com/pricing/details/storage/). |
180
179
181
-
:::image type="content" source="./media/network-watcher-nsg-flow-logging-portal/create-nsg-flow-log.png" alt-text="Screenshot of create NSG flow log page in the Azure portal.":::
180
+
:::image type="content" source="./media/nsg-flow-logs-tutorial/create-nsg-flow-log.png" alt-text="Screenshot of create NSG flow log page in the Azure portal.":::
182
181
183
182
> [!NOTE]
184
183
> The Azure portal creates NSG flow logs in the **NetworkWatcherRG** resource group.
@@ -189,7 +188,7 @@ In this section, you create an NSG flow log that's saved into the storage accoun
189
188
190
189
1. Once the deployment is complete, select **Go to resource** to confirm the flow log created and listed in the **Flow logs** page.
191
190
192
-
:::image type="content" source="./media/network-watcher-nsg-flow-logging-portal/flow-logs-list.png" alt-text="Screenshot of Flow logs page in the Azure portal showing the newly created flow log." lightbox="./media/network-watcher-nsg-flow-logging-portal/flow-logs-list.png":::
191
+
:::image type="content" source="./media/nsg-flow-logs-tutorial/flow-logs-list.png" alt-text="Screenshot of Flow logs page in the Azure portal showing the newly created flow log." lightbox="./media/nsg-flow-logs-tutorial/flow-logs-list.png":::
193
192
194
193
1. Go back to your RDP session with **myVM** virtual machine.
195
194
@@ -215,7 +214,7 @@ In this section, you go to the storage account you previously selected and downl
215
214
216
215
6. Select the ellipsis **...** to the right of the PT1H.json file, then select **Download**.
217
216
218
-
:::image type="content" source="./media/network-watcher-nsg-flow-logging-portal/nsg-log-file.png" alt-text="Screenshot showing how to download nsg flow log from the storage account container in the Azure portal.":::
217
+
:::image type="content" source="./media/nsg-flow-logs-tutorial/nsg-log-file.png" alt-text="Screenshot showing how to download nsg flow log from the storage account container in the Azure portal.":::
219
218
220
219
> [!NOTE]
221
220
> You can use Azure Storage Explorer to access and download flow logs from your storage account. Fore more information, see [Get started with Storage Explorer](../vs-azure-tools-storage-manage-with-storage-explorer.md).
@@ -284,16 +283,9 @@ When no longer needed, delete **myResourceGroup** resource group and all of the
284
283
> [!NOTE]
285
284
> The **myVM-nsg-myResourceGroup-flowlog** flow log is in the **NetworkWatcherRG** resource group, but it'll be deleted after deleting the **myVM-nsg** network security group (by deleting the **myResourceGroup** resource group).
286
285
287
-
## Next steps
288
-
289
-
In this tutorial, you learned how to:
290
-
291
-
* Enable NSG flow logging for a network security group to log traffic from and to a virtual machine.
292
-
* Download and view the flow log data.
293
-
294
-
The raw data in the JSON file can be difficult to interpret. To visualize flow logs data, you can use [Traffic analytics](traffic-analytics.md) and [Microsoft Power BI](network-watcher-visualize-nsg-flow-logs-power-bi.md).
286
+
## Related content
295
287
296
-
To learn how to monitor network communication between virtual machines using Network Watcher connection monitor, see:
288
+
- To learn more about NSG flow logs, see [Flow logging for network security groups](network-watcher-nsg-flow-logging-overview).
289
+
- To learn how to create, change, enable, disable, or delete NSG flow logs, see [Manage NSG flow logs](nsg-flow-logging).
290
+
- To learn about Traffic analytics, see [Traffic analytics overview](traffic-analytics.md).
297
291
298
-
> [!div class="nextstepaction"]
299
-
> [Monitor network communication between two virtual machines](connection-monitor.md)
0 commit comments