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
- Open the Connection Monitor page in the Azure portal.
- Select the monitor you want to modify.
- In the Tests blade, click Add test.
- 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.5Add 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 HttpTest1Best practices
- Use a mix of protocols to get a comprehensive view of network health.
- Set appropriate thresholds based on your SLA.
- Group related tests under a single monitor for easier management.