Configure tests for Azure Connection Monitor

Connection Monitor continuously checks the connectivity between a source and one or more destinations. You can add multiple test types such as ping, TCP, HTTP, and HTTPS. This article explains how to add, modify, and remove tests using the Azure portal, Azure CLI, and PowerShell.

Using the Azure portal

  1. Open the Connection Monitor page in the Azure portal.
  2. Select the monitor you want to modify.
  3. In the Tests blade, click Add test.
  4. Choose a test type, fill out the required fields, and click Save.

Add a test with Azure CLI

az network watcher connection-monitor test add \
  --name MyMonitor \
  --resource-group MyRG \
  --test-name HttpTest1 \
  --protocol Http \
  --http-method GET \
  --http-port 80 \
  --http-path "/health" \
  --destination 10.0.0.5

Add a test with PowerShell

New-AzNetworkWatcherConnectionMonitorTestConfiguration `
  -ConnectionMonitorName "MyMonitor" `
  -ResourceGroupName "MyRG" `
  -Name "TcpTest1" `
  -TestConfigurationProtocol Tcp `
  -Port 443 `
  -Destination "10.0.0.10"

Test configuration JSON schema

{
  "name": "HttpTest1",
  "testConfiguration": {
    "testFrequencySec": 60,
    "protocol": "Http",
    "httpConfiguration": {
      "method": "GET",
      "port": 80,
      "path": "/status"
    },
    "thresholds": [
      {
        "type": "SuccessRate",
        "lowerThreshold": 95.0
      }
    ]
  },
  "destination": {
    "address": "10.0.0.5",
    "port": 80
  }
}

Remove a test

To delete a test, use the following CLI command:

az network watcher connection-monitor test delete \
  --name MyMonitor \
  --resource-group MyRG \
  --test-name HttpTest1

Best practices

Copied to clipboard