Search code examples
azureazure-rm-templateazure-virtual-networkazure-resource-groupazure-bicep

Is it Possible to Name the Azure Network Watcher?


When I created an Azure virtual network, it automatically creates a Network Watcher called NetworkWatcher_canadacentral for me in its own resource group called NetworkWatcherRG.

My question is whether its possible to give the Network Watcher and the resource group it gets created in a custom name. I'm using Pulumi to Create my virtual network but answers showing ARM/Bicep/Terraform are also welcome.


Solution

  • You can name it whatever you want as long as it meets the naming requirements which is 1-80 chars, Alphanumerics, underscores, periods, and hyphens. Start with alphanumeric. End alphanumeric or underscore.

    Terraform

    In Terraform you just give the Network Watcher resource name whatever you want like so:

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

    PowerShell

    In PowerShell the command is:

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

    Pulumi

    From what I see on the Pulumi docs Network Watcher does take a name parameter.

    enter image description here