Skip to content

Commit cc03c26

Browse files
authored
Merge pull request #270456 from halkazwini/vm-windows
Add tabs for portal, PowerShell, CLI, and ARM
2 parents 4f77bc6 + 0992cb2 commit cc03c26

File tree

5 files changed

+234
-41
lines changed

5 files changed

+234
-41
lines changed
48.2 KB
Loading
98.3 KB
Loading
33.6 KB
Loading
85.7 KB
Loading
Lines changed: 234 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,85 @@
11
---
2-
title: Network Watcher Agent VM extension - Windows
2+
title: Manage Network Watcher Agent VM extension - Windows
33
description: Learn about the Network Watcher Agent virtual machine extension on Windows virtual machines and how to deploy it.
44
author: halkazwini
55
ms.author: halkazwini
66
ms.service: virtual-machines
77
ms.subservice: extensions
8-
ms.topic: concept-article
9-
ms.date: 03/25/2024
8+
ms.topic: how-to
9+
ms.date: 03/29/2024
1010
ms.collection: windows
11+
12+
#CustomerIntent: As an Azure administrator, I want to learn about Network Watcher Agent VM extension so that I can use Network watcher features to diagnose and monitor my virtual machines (VMs).
1113
---
1214

13-
# Network Watcher Agent virtual machine extension for Windows
15+
# Manage Network Watcher Agent virtual machine extension for Windows
1416

15-
[Azure Network Watcher](../../network-watcher/network-watcher-monitoring-overview.md) is a network performance monitoring, diagnostic, and analytics service that allows monitoring for Azure networks. The Network Watcher Agent virtual machine extension is a requirement for some of the Network Watcher features on Azure virtual machines (VMs), such as capturing network traffic on demand, and other advanced functionality.
17+
[Azure Network Watcher](../../network-watcher/network-watcher-monitoring-overview.md) is a network performance monitoring, diagnostic, and analytics service that allows monitoring for Azure networks. The Network Watcher Agent virtual machine extension is a requirement for some of the Network Watcher features on Azure virtual machines (VMs). For more information, see [Network Watcher Agent FAQ](../../network-watcher/frequently-asked-questions.yml#network-watcher-agent).
1618

17-
This article details the supported platforms and deployment options for the Network Watcher Agent VM extension for Windows. Installation of the agent doesn't disrupt, or require a reboot of the virtual machine. You can install the extension on virtual machines that you deploy. If the virtual machine is deployed by an Azure service, check the documentation for the service to determine whether or not it permits installing extensions in the virtual machine.
19+
In this article, you learn about the supported platforms and deployment options for the Network Watcher Agent VM extension for Windows. Installation of the agent doesn't disrupt, or require a reboot of the virtual machine. You can install the extension on virtual machines that you deploy. If the virtual machine is deployed by an Azure service, check the documentation for the service to determine whether or not it permits installing extensions in the virtual machine.
1820

1921
## Prerequisites
2022

21-
### Operating system
23+
# [**Portal**](#tab/portal)
24+
25+
- An Azure Windows virtual machine (VM). For more information, see [Supported Windows versions](#supported-operating-systems).
26+
27+
- Internet connectivity: some of the Network Watcher Agent functionality requires that the virtual machine is connected to the Internet. For example, without the ability to establish outgoing connections, the Network Watcher Agent can't upload packet captures to your storage account. For more information, see [Packet capture overview](../../network-watcher/packet-capture-overview.md).
28+
29+
# [**PowerShell**](#tab/powershell)
30+
31+
- An Azure Windows virtual machine (VM). For more information, see [Supported Windows versions](#supported-operating-systems).
32+
33+
- Internet connectivity: some of the Network Watcher Agent functionality requires that the virtual machine is connected to the Internet. For example, without the ability to establish outgoing connections, the Network Watcher Agent can't upload packet captures to your storage account. For more information, see [Packet capture overview](../../network-watcher/packet-capture-overview.md).
34+
35+
- Azure Cloud Shell or Azure PowerShell.
36+
37+
The steps in this article run the Azure PowerShell cmdlets 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 then paste it into Cloud Shell to run it. You can also run the Cloud Shell from within the Azure portal.
38+
39+
You can also [install Azure PowerShell locally](/powershell/azure/install-azure-powershell) to run the cmdlets. This article requires the Azure PowerShell `Az` module. To find the installed version, run `Get-Module -ListAvailable Az`. If you run PowerShell locally, sign in to Azure using the [Connect-AzAccount](/powershell/module/az.accounts/connect-azaccount) cmdlet.
40+
41+
# [**Azure CLI**](#tab/cli)
42+
43+
- An Azure Windows virtual machine (VM). For more information, see [Supported Windows versions](#supported-operating-systems).
2244

23-
The Network Watcher Agent extension for Windows can be configured for Windows Server 2012, 2012 R2, 2016, 2019 and 2022 releases. Currently, Nano Server isn't supported.
45+
- Internet connectivity: some of the Network Watcher Agent functionality requires that the virtual machine is connected to the Internet. For example, without the ability to establish outgoing connections, the Network Watcher Agent can't upload packet captures to your storage account. For more information, see [Packet capture overview](../../network-watcher/packet-capture-overview.md).
46+
47+
- Azure Cloud Shell or Azure CLI.
48+
49+
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.
50+
51+
You can also [install Azure CLI locally](/cli/azure/install-azure-cli) to run the commands. If you run Azure CLI locally, sign in to Azure using the [az login](/cli/azure/reference-index#az-login) command.
52+
53+
# [**Resource Manager**](#tab/arm)
54+
55+
- An Azure Windows virtual machine (VM). For more information, see [Supported Windows versions](#supported-operating-systems).
56+
57+
- Internet connectivity: some of the Network Watcher Agent functionality requires that the virtual machine is connected to the Internet. For example, without the ability to establish outgoing connections, the Network Watcher Agent can't upload packet captures to your storage account. For more information, see [Packet capture overview](../../network-watcher/packet-capture-overview.md).
58+
59+
- Azure PowerShell or Azure CLI installed locally to deploy the template.
60+
61+
- You can [install Azure PowerShell locally](/powershell/azure/install-azure-powershell) to run the cmdlets. Use [Connect-AzAccount](/powershell/module/az.accounts/connect-azaccount) cmdlet to sign in to Azure.
62+
63+
- You can [install Azure CLI locally](/cli/azure/install-azure-cli) to run the commands. Use [az login](/cli/azure/reference-index#az-login) command to sign in to Azure.
64+
65+
---
2466

25-
### Internet connectivity
67+
## Supported operating systems
2668

27-
Some of the Network Watcher Agent functionality requires that the virtual machine is connected to the Internet. Without the ability to establish outgoing connections, the Network Watcher Agent can't upload packet captures to your storage account. For more information, please see the [Network Watcher documentation](../../network-watcher/index.yml).
69+
Network Watcher Agent extension for Windows can be installed on Windows Server 2012, 2012 R2, 2016, 2019 and 2022 releases. Currently, Nano Server isn't supported.
2870

2971
## Extension schema
3072

3173
The following JSON shows the schema for the Network Watcher Agent extension. The extension doesn't require, or support, any user-supplied settings, and relies on its default configuration.
3274

33-
3475
```json
3576
{
36-
"type": "Microsoft.Compute/virtualMachines/extensions",
37-
"apiVersion": "[variables('apiVersion')]",
3877
"name": "[concat(parameters('vmName'), '/AzureNetworkWatcherExtension')]",
78+
"type": "Microsoft.Compute/virtualMachines/extensions",
79+
"apiVersion": "2023-03-01",
3980
"location": "[resourceGroup().location]",
4081
"dependsOn": [
41-
"[resourceId('Microsoft.Compute/virtualMachines', parameters('vmName'))]"
82+
"[concat('Microsoft.Compute/virtualMachines/', parameters('vmName'))]"
4283
],
4384
"properties": {
4485
"autoUpgradeMinorVersion": true,
@@ -47,53 +88,205 @@ The following JSON shows the schema for the Network Watcher Agent extension. The
4788
"typeHandlerVersion": "1.4"
4889
}
4990
}
91+
```
92+
## List installed extensions
93+
94+
# [**Portal**](#tab/portal)
95+
96+
From the virtual machine page in the Azure portal, you can view the installed extension by following these steps:
97+
98+
1. Under **Settings**, select **Extensions + applications**.
99+
100+
1. In the **Extensions** tab, you can see all installed extensions on the virtual machine. If the list is long, you can use the search box to filter the list.
101+
102+
:::image type="content" source="./media/network-watcher/list-vm-extensions.png" alt-text="Screenshot that shows how to view installed extensions on a VM in the Azure portal." lightbox="./media/network-watcher/list-vm-extensions.png":::
103+
104+
# [**PowerShell**](#tab/powershell)
105+
106+
Use [Get-AzVMExtension](/powershell/module/az.compute/get-azvmextension) cmdlet to list all installed extensions on the virtual machine:
50107

108+
```azurepowershell-interactive
109+
# List the installed extensions on the virtual machine.
110+
Get-AzVMExtension -VMName 'myVM' -ResourceGroupName 'myResourceGroup' | format-table Name, Publisher, ExtensionType, EnableAutomaticUpgrade
51111
```
52112

53-
### Property values
113+
The output of the cmdlet lists the installed extensions:
54114

55-
| Name | Value / Example |
56-
| ---- | ---- |
57-
| apiVersion | 2023-03-01 |
58-
| publisher | Microsoft.Azure.NetworkWatcher |
59-
| type | NetworkWatcherAgentWindows |
60-
| typeHandlerVersion | 1.4 |
115+
```output
116+
Name Publisher ExtensionType EnableAutomaticUpgrade
117+
---- --------- ------------- ----------------------
118+
AzureNetworkWatcherExtension Microsoft.Azure.NetworkWatcher NetworkWatcherAgentWindows True
119+
AzurePolicyforWindows Microsoft.GuestConfiguration ConfigurationforWindows True
120+
```
61121

62122

63-
## Template deployment
123+
# [**Azure CLI**](#tab/cli)
64124

65-
You can deploy Azure VM extensions with an Azure Resource Manager template (ARM template) using the previous JSON [schema](#extension-schema).
125+
Use [az vm extension list](/cli/azure/vm/extension#az-vm-extension-list) command to list all installed extensions on the virtual machine:
66126

67-
## PowerShell deployment
127+
```azurecli
128+
# List the installed extensions on the virtual machine.
129+
az vm extension list --resource-group 'myResourceGroup' --vm-name 'myVM' --out table
130+
```
68131

69-
Use the `Set-AzVMExtension` command to deploy the Network Watcher Agent virtual machine extension to an existing virtual machine:
132+
The output of the command lists the installed extensions:
70133

71-
```powershell
72-
Set-AzVMExtension `
73-
-ResourceGroupName "myResourceGroup" `
74-
-Location "WestUS" `
75-
-VMName "myVM" `
76-
-Name "networkWatcherAgent" `
77-
-Publisher "Microsoft.Azure.NetworkWatcher" `
78-
-Type "NetworkWatcherAgentWindows" `
79-
-TypeHandlerVersion "1.4"
134+
```output
135+
Name ProvisioningState Publisher Version AutoUpgradeMinorVersion
136+
---------------------------- ------------------- ------------------------------ --------- -------------------------
137+
AzureNetworkWatcherExtension Succeeded Microsoft.Azure.NetworkWatcher 1.4 True
138+
AzurePolicyforWindows Succeeded Microsoft.GuestConfiguration 1.1 True
80139
```
81140

82-
## Troubleshooting
141+
# [**Resource Manager**](#tab/arm)
142+
143+
N/A
144+
145+
---
146+
147+
## Install Network Watcher Agent VM extension
148+
149+
# [**Portal**](#tab/portal)
150+
151+
From the virtual machine page in the Azure portal, you can install the Network Watcher Agent VM extension by following these steps:
152+
153+
1. Under **Settings**, select **Extensions + applications**.
154+
155+
1. Select **+ Add** and search for **Network Watcher Agent** and install it. If the extension is already installed, you can see it in the list of extensions.
156+
157+
:::image type="content" source="./media/network-watcher/vm-extensions.png" alt-text="Screenshot that shows the VM's extensions page in the Azure portal." lightbox="./media/network-watcher/vm-extensions.png":::
83158

84-
You can retrieve data about the state of extension deployments from the Azure portal and PowerShell. To see the deployment state of extensions for a given VM, run the following command using the Azure PowerShell module:
159+
1. In the search box of **Install an Extension**, enter *Network Watcher Agent for Windows*. Select the extension from the list and select **Next**.
85160

86-
```powershell
87-
Get-AzVMExtension -ResourceGroupName myResourceGroup1 -VMName myVM1 -Name networkWatcherAgent
161+
:::image type="content" source="./media/network-watcher/install-extension-windows.png" alt-text="Screenshot that shows how to install Network Watcher Agent for Windows in the Azure portal." lightbox="./media/network-watcher/install-extension-windows.png":::
162+
163+
1. Select **Review + create** and then select **Create**.
164+
165+
# [**PowerShell**](#tab/powershell)
166+
167+
Use [Set-AzVMExtension](/powershell/module/az.compute/set-azvmextension) cmdlet to install Network Watcher Agent VM extension on the virtual machine:
168+
169+
```azurepowershell-interactive
170+
# Install Network Watcher Agent for Windows on the virtual machine.
171+
Set-AzVMExtension -Name 'AzureNetworkWatcherExtension' -Publisher 'Microsoft.Azure.NetworkWatcher' -ExtensionType 'NetworkWatcherAgentWindows' -EnableAutomaticUpgrade 1 -TypeHandlerVersion '1.4' -ResourceGroupName 'myResourceGroup' -VMName 'myVM'
172+
```
173+
174+
Once the installation is successfully completed, you see the following output:
175+
176+
```output
177+
RequestId IsSuccessStatusCode StatusCode ReasonPhrase
178+
--------- ------------------- ---------- ------------
179+
True OK
180+
```
181+
182+
# [**Azure CLI**](#tab/cli)
183+
184+
Use [az vm extension set](/cli/azure/vm/extension#az-vm-extension-set) command to install Network Watcher Agent VM extension on the virtual machine:
185+
186+
```azurecli
187+
# Install Network Watcher Agent for Windows on the virtual machine.
188+
az vm extension set --name 'NetworkWatcherAgentWindows' --extension-instance-name 'AzureNetworkWatcherExtension' --publisher 'Microsoft.Azure.NetworkWatcher' --enable-auto-upgrade 'true' --version '1.4' --resource-group 'myResourceGroup' --vm-name 'myVM'
88189
```
89190

90-
Extension execution output is logged to files found in the following directory:
191+
# [**Resource Manager**](#tab/arm)
91192

92-
```cmd
93-
C:\WindowsAzure\Logs\Plugins\Microsoft.Azure.NetworkWatcher.NetworkWatcherAgentWindows\
193+
Use the following Azure Resource Manager template (ARM template) to install Network Watcher Agent VM extension on a Windows virtual machine:
194+
195+
```json
196+
{
197+
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
198+
"contentVersion": "1.0.0.0",
199+
"parameters": {
200+
"vmName": {
201+
"type": "string"
202+
}
203+
},
204+
"variables": {},
205+
"resources": [
206+
{
207+
"name": "[parameters('vmName')]",
208+
"type": "Microsoft.Compute/virtualMachines",
209+
"apiVersion": "2023-03-01",
210+
"location": "[resourceGroup().location]",
211+
"properties": {
212+
}
213+
},
214+
{
215+
"name": "[concat(parameters('vmName'), '/AzureNetworkWatcherExtension')]",
216+
"type": "Microsoft.Compute/virtualMachines/extensions",
217+
"apiVersion": "2023-03-01",
218+
"location": "[resourceGroup().location]",
219+
"dependsOn": [
220+
"[concat('Microsoft.Compute/virtualMachines/', parameters('vmName'))]"
221+
],
222+
"properties": {
223+
"autoUpgradeMinorVersion": true,
224+
"publisher": "Microsoft.Azure.NetworkWatcher",
225+
"type": "NetworkWatcherAgentWindows",
226+
"typeHandlerVersion": "1.4"
227+
}
228+
}
229+
],
230+
"outputs": {}
231+
}
94232
```
95233

234+
You can use either Azure PowerShell or Azure CLI to deploy the Resource Manager template:
235+
236+
```azurepowershell
237+
# Deploy the JSON template file using Azure PowerShell.
238+
New-AzResourceGroupDeployment -ResourceGroupName 'myResourceGroup' -TemplateFile 'agent.json'
239+
```
240+
241+
```azurecli
242+
# Deploy the JSON template file using the Azure CLI.
243+
az deployment group create --resource-group 'myResourceGroup' --template-file
244+
```
245+
246+
---
247+
248+
## Uninstall Network Watcher Agent VM extension
249+
250+
# [**Portal**](#tab/portal)
251+
252+
From the virtual machine page in the Azure portal, you can uninstall the Network Watcher Agent VM extension by following these steps:
253+
254+
1. Under **Settings**, select **Extensions + applications**.
255+
256+
1. Select **AzureNetworkWatcherExtension** from the list of extensions, and then select **Uninstall**.
257+
258+
:::image type="content" source="./media/network-watcher/uninstall-extension-windows.png" alt-text="Screenshot that shows how to uninstall Network Watcher Agent for Windows in the Azure portal." lightbox="./media/network-watcher/uninstall-extension-windows.png":::
259+
260+
> [!NOTE]
261+
> In the list of extensions, you might see Network Watcher Agent VM extension named differently than **AzureNetworkWatcherExtension**.
262+
263+
# [**PowerShell**](#tab/powershell)
264+
265+
Use [Remove-AzVMExtension](/powershell/module/az.compute/remove-azvmextension) cmdlet to remove Network Watcher Agent VM extension from the virtual machine:
266+
267+
```azurepowershell-interactive
268+
# Uninstall Network Watcher Agent VM extension.
269+
Remove-AzureVMExtension -Name 'AzureNetworkWatcherExtension' -ResourceGroupName 'myResourceGroup' -VMName 'myVM'
270+
```
271+
272+
# [**Azure CLI**](#tab/cli)
273+
274+
Use [az vm extension delete](/cli/azure/vm/extension#az-vm-extension-delete) command to remove Network Watcher Agent VM extension from the virtual machine:
275+
276+
```azurecli-interactive
277+
# Uninstall Network Watcher Agent VM extension.
278+
az vm extension delete --name 'AzureNetworkWatcherExtension' --resource-group 'myResourceGroup' --vm-name 'myVM'
279+
```
280+
281+
# [**Resource Manager**](#tab/arm)
282+
283+
N/A
284+
285+
---
286+
287+
96288
## Related content
97289

290+
- [Update Azure Network Watcher extension to the latest version](network-watcher-update.md).
98291
- [Network Watcher documentation](../../network-watcher/index.yml).
99292
- [Microsoft Q&A - Network Watcher](/answers/topics/azure-network-watcher.html).

0 commit comments

Comments
 (0)