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
description: Learn how to create, change, enable, disable, or delete Azure Network Watcher virtual network flow logs using the Azure portal.
4
+
description: Learn how to create, change, enable, disable, or delete Azure Network Watcher virtual network flow logs.
5
5
author: halkazwini
6
6
ms.author: halkazwini
7
7
ms.service: azure-network-watcher
8
8
ms.topic: how-to
9
-
ms.date: 07/26/2024
9
+
ms.date: 03/14/2025
10
10
11
11
#CustomerIntent: As an Azure administrator, I want to log my virtual network IP traffic using Network Watcher VNet flow logs so that I can analyze it later.
12
12
---
@@ -19,16 +19,52 @@ In this article, you learn how to create, change, enable, disable, or delete a v
19
19
20
20
## Prerequisites
21
21
22
-
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
22
+
# [**Portal**](#tab/portal)
23
+
24
+
An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
23
25
24
26
- Insights provider. For more information, see [Register Insights provider](#register-insights-provider).
25
27
26
28
- A virtual network. If you need to create a virtual network, see [Create a virtual network using the Azure portal](../virtual-network/quick-create-portal.md?toc=/azure/network-watcher/toc.json).
27
29
28
30
- An Azure storage account. If you need to create a storage account, see [Create a storage account using the Azure portal](../storage/common/storage-account-create.md?tabs=azure-portal&toc=/azure/network-watcher/toc.json).
29
31
32
+
# [**PowerShell**](#tab/powershell)
33
+
34
+
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
35
+
36
+
- Insights provider. For more information, see [Register Insights provider](#register-insights-provider).
37
+
38
+
- A virtual network. If you need to create a virtual network, see [Create a virtual network using PowerShell](../virtual-network/quick-create-powershell.md).
39
+
40
+
- An Azure storage account. If you need to create a storage account, see [Create a storage account using PowerShell](../storage/common/storage-account-create.md?tabs=azure-powershell).
41
+
42
+
- PowerShell environment in [Azure Cloud Shell](https://shell.azure.com) or Azure PowerShell installed locally. To learn more about using PowerShell in Azure Cloud Shell, see [Azure Cloud Shell Quickstart - PowerShell](../cloud-shell/quickstart-powershell.md).
43
+
44
+
- If you choose to install and use PowerShell locally, this article requires the Azure PowerShell version 7.4.0 or later. Run `Get-InstalledModule -Name Az` to find the installed version. If you need to upgrade, see [Install Azure PowerShell module](/powershell/azure/install-Az-ps). Run `Connect-AzAccount` to sign in to Azure.
45
+
46
+
# [**Azure CLI**](#tab/cli)
47
+
48
+
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
49
+
50
+
- Insights provider. For more information, see [Register Insights provider](#register-insights-provider).
51
+
52
+
- A virtual network. If you need to create a virtual network, see [Create a virtual network using the Azure CLI](../virtual-network/quick-create-cli.md).
53
+
54
+
- An Azure storage account. If you need to create a storage account, see [Create a storage account using the Azure CLI](../storage/common/storage-account-create.md?tabs=azure-cli).
55
+
56
+
- Azure Cloud Shell or Azure CLI.
57
+
58
+
The steps in this article run the Azure CLI commands interactively in [Azure Cloud Shell](/azure/cloud-shell/overview). To run the commands in the Cloud Shell, select **Open Cloud Shell** at the upper-right corner of a code block. Select **Copy** to copy the code, and paste it into Cloud Shell to run it. You can also run the Cloud Shell from within the Azure portal.
59
+
60
+
You can also [install Azure CLI locally](/cli/azure/install-azure-cli) to run the commands. This article requires the Azure CLI version 2.39.0 or later. Run [az --version](/cli/azure/reference-index#az-version) command to find the installed version. If you run Azure CLI locally, sign in to Azure using the [az login](/cli/azure/reference-index#az-login) command.
61
+
62
+
---
63
+
30
64
## Register Insights provider
31
65
66
+
# [**Portal**](#tab/portal)
67
+
32
68
*Microsoft.Insights* provider must be registered to successfully log traffic flowing through a virtual network. If you aren't sure if the *Microsoft.Insights* provider is registered, check its status in the Azure portal by following these steps:
33
69
34
70
1. In the search box at the top of the portal, enter *subscriptions*. Select **Subscriptions** from the search results.
@@ -45,6 +81,26 @@ In this article, you learn how to create, change, enable, disable, or delete a v
45
81
46
82
:::image type="content" source="./media/vnet-flow-logs-portal/register-microsoft-insights.png" alt-text="Screenshot that shows how to register Microsoft Insights provider in the Azure portal.":::
47
83
84
+
# [**PowerShell**](#tab/powershell)
85
+
86
+
*Microsoft.Insights* provider must be registered to successfully log traffic in a virtual network. If you aren't sure if the *Microsoft.Insights* provider is registered, use [Register-AzResourceProvider](/powershell/module/az.resources/register-azresourceprovider) to register it.
*Microsoft.Insights* provider must be registered to successfully log traffic in a virtual network. If you aren't sure if the *Microsoft.Insights* provider is registered, use [az provider register](/cli/azure/provider#az-provider-register) to register it.
96
+
97
+
```azurecli-interactive
98
+
# Register Microsoft.Insights provider.
99
+
az provider register --namespace Microsoft.Insights
100
+
```
101
+
102
+
---
103
+
48
104
## Create a flow log
49
105
50
106
Create a flow log for your virtual network, subnet, or network interface. This flow log is saved in an Azure storage account.
0 commit comments