Create an Azure Network Watcher instance

  1. Home
  2. Create an Azure Network Watcher instance

Go back to Tutorial

In this we will learn about creating an Azure Network Watcher instance. However, Network Watcher is a regional service that enables you to monitor and diagnose conditions at a network scenario level in, to, and from Azure. Scenario level monitoring enables you to diagnose problems at an end to end network level view. Network diagnostic and visualization tools available with Network Watcher help you understand, diagnose, and gain insights to your network in Azure. However, Network Watcher is enabled through the creation of a Network Watcher resource. This resource allows you to utilize Network Watcher capabilities.

Network Watcher is automatically enabled

Firstly, when you create or update a virtual network in your subscription, Network Watcher will be enabled automatically in your Virtual Network’s region. However, there is no impact to your resources or associated charge for automatically enabling Network Watcher.

Opt-out of Network Watcher automatic enablement

If you would like to opt out of Network Watcher automatic enablement, you can do so by running the following commands:

Azure PowerShell
Register-AzProviderFeature -FeatureName DisableNetworkWatcherAutocreation -ProviderNamespace Microsoft.Network
Register-AzResourceProvider -ProviderNamespace Microsoft.Network

Azure CLI
az feature register –name DisableNetworkWatcherAutocreation –namespace Microsoft.Network
az provider register -n Microsoft.Network

Create a Network Watcher in the portal

Navigate to All Services > Networking > Network Watcher. You can select all the subscriptions you want to enable Network Watcher for. However, this action creates a Network Watcher in every region that is available.

When you enable Network Watcher using the portal, the name of the Network Watcher instance is automatically set to NetworkWatcher_region_name where region_name corresponds to the Azure region where the instance is enabled. For example, a Network Watcher enabled in the West Central US region is named NetworkWatcher_westcentralus. However, the Network Watcher instance is automatically created in a resource group named NetworkWatcherRG.

AZ-104  practice tests

Create a Network Watcher with PowerShell

Firstly, to create an instance of Network Watcher, run the following example:

PowerShell
New-AzNetworkWatcher -Name “NetworkWatcher_westcentralus” -ResourceGroupName “NetworkWatcherRG” -Location “West Central US”

Create a Network Watcher with the Azure CLI

Next, to create an instance of Network Watcher, run the following example:

Azure CLI
az network watcher configure –resource-group NetworkWatcherRG –locations westcentralus –enabled

Create a Network Watcher with the REST API

The ARMclient calls the REST API using PowerShell. The ARMClient is found on chocolatey at ARMClient on Chocolatey

Log in with ARMClient

powerShell
armclient login

Create the network watcher

PowerShell
$subscriptionId = ”
$networkWatcherName = ”
$resourceGroupName = ”
$apiversion = “2016-09-01”
$requestBody = @”
{
‘location’: ‘West Central US’
}
“@

armclient put “https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.Network/networkWatchers/${networkWatcherName}?api-version=${api-version}” $requestBody

Delete a Network Watcher in the portal

Navigate to All Services > Networking > Network Watcher.

  • Firstly, select the overview tab, if you’re not already there.
  • Then, use the dropdown to select the subscription you want to disable network watcher in.
  • After that, expand the list of regions for your chosen subscription by clicking on the arrow.
  • Next, for any given, use the 3 dots on the right to access the context menu. Then, click on “Disable network watcher” to start disabling.
  • After that, click Yes to continue and On the portal, you will have to do this individually for every region in every subscription.

Delete a Network Watcher with PowerShell

To delete an instance of Network Watcher, run the following example:

PowerShell
New-AzResourceGroup -Name NetworkWatcherRG -Location westcentralus
New-AzNetworkWatcher -Name NetworkWatcher_westcentralus -ResourceGroup NetworkWatcherRG -Location westcentralus
Remove-AzNetworkWatcher -Name NetworkWatcher_westcentralus -ResourceGroup NetworkWatcherRG

Create an Azure Network Watcher instance AZ-104 online course

Reference: Microsoft Documentation

Go back to Tutorial

Menu