Coder Perfect

Is it possible to give the Azure Network Watcher a different name?

Problem

When I build an Azure virtual network, it generates a Network Watcher named NetworkWatcher canadacentral in its own resource group called NetworkWatcherRG for me.

My question is if the Network Watcher and the resource group it creates can be given a unique name. I’m using Pulumi to build my virtual network, but ARM/Bicep/Terraform responses are also appreciated.

Asked by Muhammad Rehan Saeed

Solution #1

You can call it whatever you like as long as it is between 1-80 characters long and contains Alphanumerics, underscores, periods, and hyphens. Begin with alphanumeric characters. End with an underscore or an alphanumeric character.

You can name the Network Watcher resource whatever you wish in Terraform, for example:

resource "azurerm_network_watcher" "app1_traffic" {
  name                = "MyAwesomeNetworkWatcherName"
  location            = azurerm_resource_group.application1.location
  resource_group_name = azurerm_resource_group.application1.name
}

The command in PowerShell is:

New-AzNetworkWatcher -Name "MyNetworkWatcherName" -ResourceGroupName "secstuff" -Location "East US 2"

According to the Pulumi documentation, Network Watcher accepts a name parameter.

Answered by Ken W MSFT

Post is based on https://stackoverflow.com/questions/71068929/is-it-possible-to-name-the-azure-network-watcher