Skip to content

Commit 5b923c7

Browse files
authored
Merge pull request #253330 from halkazwini/nw-bicep
Network Watcher: Freshness: Quickstart: Configure NSG flow logs using a Bicep file
2 parents c39928a + 67d8883 commit 5b923c7

File tree

1 file changed

+49
-31
lines changed

1 file changed

+49
-31
lines changed
Lines changed: 49 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,72 @@
11
---
2-
title: 'Quickstart: Configure Network Watcher network security group flow logs using a Bicep file'
3-
description: Learn how to enable network security group (NSG) flow logs programmatically using Bicep and Azure PowerShell.
4-
services: network-watcher
2+
title: 'Quickstart: Configure NSG flow logs using a Bicep file'
3+
titleSuffix: Azure Network Watcher
4+
description: In this quickstart, you learn how to enable NSG flow logs programmatically using a Bicep file to log the traffic flowing through a network security group.
55
author: halkazwini
66
ms.author: halkazwini
7-
ms.date: 08/26/2022
8-
ms.topic: quickstart
97
ms.service: network-watcher
10-
ms.custom: devx-track-azurepowershell, subject-bicepqs, mode-arm, devx-track-bicep
11-
#Customer intent: I need to enable the network security group flow logs by using a Bicep file.
8+
ms.topic: quickstart
9+
ms.date: 09/29/2023
10+
ms.custom: devx-track-bicep, devx-track-azurecli, devx-track-azurepowershell, subject-bicepqs, mode-arm,
11+
12+
#CustomerIntent: As an Azure administrator, I need to enable NSG flow logs using a Bicep file so that I can log the traffic flowing through a network security group.
1213
---
1314

14-
# Quickstart: Configure network security group flow logs using a Bicep file
15+
# Quickstart: Configure Azure Network Watcher NSG flow logs using a Bicep file
1516

16-
In this quickstart, you learn how to enable [network security group (NSG) flow logs](network-watcher-nsg-flow-logging-overview.md) by using a Bicep file
17+
In this quickstart, you learn how to enable [NSG flow logs](network-watcher-nsg-flow-logging-overview.md) using a Bicep file
1718

1819
[!INCLUDE [About Bicep](../../includes/resource-manager-quickstart-bicep-introduction.md)]
1920

20-
We start with an overview of the properties of the NSG flow log object. We provide a sample Bicep file. Then, we deploy the Bicep file.
21-
2221
## Prerequisites
2322

24-
If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
23+
- 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.
24+
25+
- To deploy the Bicep files, either Azure CLI or PowerShell installed.
26+
27+
# [CLI](#tab/cli)
28+
29+
1. [Install Azure CLI locally](/cli/azure/install-azure-cli) to run the commands.
30+
31+
1. Sign in to Azure using the [az login](/cli/azure/reference-index#az-login) command.
32+
33+
# [PowerShell](#tab/powershell)
34+
35+
1. [Install Azure PowerShell locally](/powershell/azure/install-azure-powershell) to run the cmdlets.
36+
37+
1. Sign in to Azure using the [Connect-AzAccount](/powershell/module/az.accounts/connect-azaccount) cmdlet.
38+
39+
---
2540

2641
## Review the Bicep file
2742

28-
The Bicep file that we use in this quickstart is from [Azure Quickstart Templates](https://azure.microsoft.com/resources/templates/networkwatcher-flowlogs-create/).
43+
This quickstart uses the [Create NSG flow logs](https://github.com/Azure/azure-quickstart-templates/blob/master/quickstarts/microsoft.network/networkwatcher-flowLogs-create/main.bicep) Bicep template from [Azure Quickstart Templates](https://azure.microsoft.com/resources/templates/networkwatcher-flowlogs-create/).
2944

3045
:::code language="bicep" source="~/quickstart-templates/quickstarts/microsoft.network/networkwatcher-flowLogs-create/main.bicep" range="1-67" highlight="51-67":::
3146

32-
These resources are defined in the Bicep file:
47+
The following resources are defined in the Bicep file:
3348

3449
- [Microsoft.Storage/storageAccounts](/azure/templates/microsoft.storage/storageaccounts?pivots=deployment-language-bicep)
3550
- [Microsoft.Network networkWatchers](/azure/templates/microsoft.network/networkwatchers?tabs=bicep&pivots=deployment-language-bicep)
3651
- [Microsoft.Network networkWatchers/flowLogs](/azure/templates/microsoft.network/networkwatchers/flowlogs?tabs=bicep&pivots=deployment-language-bicep)
3752

38-
The highlighted code in the preceding sample shows an NSG flow resource definition.
53+
The highlighted code in the preceding sample shows an NSG flow log resource definition.
3954

4055
## Deploy the Bicep file
4156

42-
This tutorial assumes that you have a network security group that you can enable flow logging on.
57+
This quickstart assumes that you have a network security group that you can enable flow logging on.
4358

4459
1. Save the Bicep file as **main.bicep** to your local computer.
4560
1. Deploy the Bicep file using either Azure CLI or Azure PowerShell.
4661

47-
# [CLI](#tab/CLI)
62+
# [CLI](#tab/cli)
4863

4964
```azurecli
5065
az group create --name exampleRG --location eastus
5166
az deployment group create --resource-group exampleRG --template-file main.bicep
5267
```
5368
54-
# [PowerShell](#tab/PowerShell)
69+
# [PowerShell](#tab/powershell)
5570
5671
```azurepowershell
5772
New-AzResourceGroup -Name exampleRG -Location eastus
@@ -60,7 +75,7 @@ This tutorial assumes that you have a network security group that you can enable
6075
6176
---
6277
63-
You will be prompted to enter the resource ID of the existing network security group. The syntax of the network security group resource ID is:
78+
You'll be prompted to enter the resource ID of the existing network security group. The syntax of the network security group resource ID is:
6479
6580
```json
6681
"/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.Network/networkSecurityGroups/<network-security-group-name>"
@@ -75,25 +90,28 @@ You have two options to see whether your deployment succeeded:
7590
- Your console shows `ProvisioningState` as `Succeeded`.
7691
- Go to the [NSG flow logs portal page](https://portal.azure.com/#blade/Microsoft_Azure_Network/NetworkWatcherMenuBlade/flowLogs) to confirm your changes.
7792
78-
If there were issues with the deployment, see [Troubleshoot common Azure deployment errors with Azure Resource Manager](../azure-resource-manager/troubleshooting/common-deployment-errors.md).
93+
If there are issues with the deployment, see [Troubleshoot common Azure deployment errors with Azure Resource Manager](../azure-resource-manager/troubleshooting/common-deployment-errors.md).
7994
8095
## Clean up resources
8196
82-
You can delete Azure resources by using complete deployment mode. To delete a flow logs resource, specify a deployment in complete mode without including the resource you want to delete. Read more about [complete deployment mode](../azure-resource-manager/templates/deployment-modes.md#complete-mode).
97+
You can delete Azure resources using complete deployment mode. To delete a flow logs resource, specify a deployment in complete mode without including the resource you want to delete. Read more about [complete deployment mode](../azure-resource-manager/templates/deployment-modes.md#complete-mode).
8398
8499
You also can disable an NSG flow log in the Azure portal:
85100
86101
1. Sign in to the Azure portal.
87-
1. Select **All services**. In the **Filter** box, enter **network watcher**. In the search results, select **Network Watcher**.
88-
1. Under **Logs**, select **NSG flow logs**.
89-
1. In the list of NSGs, select the NSG for which you want to disable flow logs.
90-
1. Under **Flow logs settings**, select **Off**.
91-
1. Select **Save**.
92102
93-
## Next steps
103+
1. In the search box at the top of the portal, enter ***network watcher***. Select **Network Watcher** from the search results.
104+
105+
1. Under **Logs**, select **Flow logs**.
106+
107+
1. In the list of flow logs, select the flow log that you want to disable.
108+
109+
1. Select **Disable**.
110+
111+
## Related content
94112
95-
In this quickstart, you learned how to enable NSG flow logs by using a Bicep file. Next, learn how to visualize your NSG flow data by using one of these options:
113+
To learn how to visualize your NSG flow logs data, see:
96114
97-
- [Microsoft Power BI](network-watcher-visualize-nsg-flow-logs-power-bi.md)
98-
- [Open-source tools](network-watcher-visualize-nsg-flow-logs-open-source-tools.md)
99-
- [Azure Traffic Analytics](traffic-analytics.md)
115+
- [Visualizing NSG flow logs using Power BI](network-watcher-visualize-nsg-flow-logs-power-bi.md).
116+
- [Visualize NSG flow logs using open source tools](network-watcher-visualize-nsg-flow-logs-open-source-tools.md).
117+
- [Traffic Analytics](traffic-analytics.md).

0 commit comments

Comments
 (0)