Today I want to talk to you about Azure Network Watcher, an extremely useful tool to diagnose and repair the state of the IaaS network. Once this tool is enabled in our region, we can use a variety of tools to check and repair the communication between the different resources that are part of our virtual network, such as virtual machines, virtual networks, application gateways, load, etc.

Network Watcher has two categories of tools:

  • Monitoring tools
  • Diagnostic tools

In this post, I want to show you how to enable or disable Network Watcher for an Azure region using PowerShell and Azure CLI. In a future post, I will show you how to use different monitoring and diagnostic tools using command-line tools.

Prerequisites

  • This tutorial assumes that you already have a Microsoft Azure account configured.

Important: When you create or update a virtual network in your subscription, Network Watcher will be enabled automatically in your Virtual Network’s region.

Azure PowerShell Workaround

If you want to know how to install the PowerShell Azure module on your machine, check out this link.

The simplest way to get started is to sign in interactively at the command line.

This cmdlet will bring up a dialog box prompting you for your email address and password associated with your Azure account.
If you have more than one subscription associated with your mail account, you can choose the default subscription. To perform this task, we will use the following commands:

Once you set your default subscription, you’re ready to start.

Set the variables

Here, we define the characteristics of our environment and the resource’s properties.

Enable Network Watcher

To enable Azure Network watcher on your region, using the New-AzNetworkWatcher cmdlet with the following syntax.

New-AzNetworkWatcher

Disable Network Watcher

if you want to disable Azure Network watcher on your region, you should use the Remove-AzNetworkWatcher cmdlet with the following syntax.

Azure CLI Workaround

In this case, we will use Azure Cloud Shell, a browser-based shell built into Azure Portal. This allows us to use the Azure command-line tools (Azure CLI and Azure PowerShell) directly from a browser. If you want to know more about Azure Cloud Shell, check out this link.

First, we define the characteristics of our environment and store the values in variables.

Enable Network Watcher

To enable Network Watcher, run the following command.

Azure Network Watcher

Disable Network Watcher

If you need to disable Azure Network watcher for any reason, use the following command.

Azure Network Watcher

Thanks for reading my post. I hope you find it useful.

For more information about Network Watcher, see this link:https://docs.microsoft.com/en-us/azure/network-watcher/