incremental ARM Template for Azure Network Watcher Connection Monitor (preview)?

David Beleznay 41 Reputation points
2020-11-19T19:14:00.2+00:00

Hi there,

I have an arm template for an Azure Network Watcher Connection Monitor (preview), but I'm finding some differences between ARM and the UI.

What I want to do:

I have a dynamic number of application servers, I'd like to use a copy / copyIndex to set up extra endpoints and testgroups.

Where I'm having problems.

in the UI, I'm able to create Test configurations that are not referenced in a test group, I'd like to just define all my test configurations at once even though I'm not using them all.

I haven't tried adding my extra endpoints as a copy index yet, but I'm afraid that it's not going to work.

I'm not able to create a network monitor preview with no testgroups or blank test configurations and add them later, i had to hardcode app1 there.

Here's where I'm at so far. 41182-creating-monitoring-making-template-1json.txt

Azure Network Watcher
Azure Network Watcher
An Azure service that is used to monitor, diagnose, and gain insights into network performance and health.
169 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. David Beleznay 41 Reputation points
    2020-11-19T22:00:35.387+00:00

    e.g. I want to be able to add something like this to the template

            {
                "apiVersion": "2020-04-01",
                "name": "[concat('NetworkWatcher_', variables('monitorRegion'), '/', variables('networkMonitorName'), '/app-1' )]",
                "location": "westus2",
                "type": "Microsoft.Network/networkWatchers/connectionMonitors/connectionMonitorEndpoint",
                "properties": {
                        "name": "[reference(resourceId(variables('appResourceGroupName'), 'Microsoft.Compute/virtualMachines', concat(variables('deploymentName'), '-app-1')), '2020-06-01').osProfile.computername]",
                        "type": "AzureVM",
                        "resourceId": "[resourceId(variables('appResourceGroupName'), 'Microsoft.Compute/virtualMachines', concat(variables('deploymentName'), '-app-1'))]"
                }
            }
    

    ( where I would replace the app-1 with app-', copyIndex() )

    but that seems to not work. I get the following error.

    Deployment failed. Correlation ID: e8c249ce-04a8-4245-9b0e-17c38bf85be6. {
    "Message": "No HTTP resource was found that matches the request URI 'https://westus2.network.azure.com:30004/...../subscriptions/.../resourcegroups/NetworkWatcherRG/providers/Microsoft.Network/networkWatchers/NetworkWatcher_westus2/connectionMonitors/rl0-davedev2-networkMonitor1/connectionMonitorEndpoint/app-1?api-version=2020-04-01'."

    0 comments No comments

  2. TravisCragg-MSFT 5,681 Reputation points Microsoft Employee
    2020-11-20T20:39:01.503+00:00

    Can you describe how you can make a test configuration without a test group? I am not able to find a way to do that in the portal.

    Templates can be tricky, and it is especially difficult with connection monitor. Resources.azure.com does not show connection monitor (preview) resources. When you edit or create a connection monitor, you can 'download template' at the create / update screen. This will allow you to get the API version / template structure of an existing Network Watcher / proposed changes.

    41469-image.png

    From what I can tell, the test groups are not stand alone objects, and you will need to update the entire connection monitor object every time you make changes to a test group.

    0 comments No comments

  3. David Beleznay 41 Reputation points
    2020-11-24T19:27:44.94+00:00

    The template that is output from downloading the template is not valid on its own. it needs to be massaged a little. I started with that when I was doing this initially.

    ah, you do appear to be correct, I do need to fully define a test group in the UI.

    My solution to this unfortunately ended up being to set up a jinja template and pre-process it before submitting it to arm.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.