farmer icon indicating copy to clipboard operation
farmer copied to clipboard

Alert dependable on Action Group

Open OutOfScopeia opened this issue 1 month ago • 0 comments

The problem: We encountered a case where our deployment failed because an alert (microsoft.insights/metricAlerts) that contains an add_action with an action group (defined in the same script, the same template) was being deployed before the action group existed. I figured I needed to be explicit about deployment order, using the ARM template's dependsOn mechanism. There is already one add_linked_resource in the alert config, linking the appInsights instance, and I inserted another one, linking the Action Group by its Id. This is legal in Farmer (no compile errors/warnings), but it generates an invalid ARM template. On closer inspection of the generated template, the add_linked_resource adds the linked resource in 3 places: the dependsOn part - which is exactly what I intended, tags - this one's ok, scopes - this is the one that makes the template illegal.

The error message when attempting to deploy this illegal template manually from azure portal is: "Scopes property is invalid. Only single resource is allowed for criteria type SingleResourceMultipleMetricCriteria. If you want to create an alert on multiple resources, use MultipleResourceMultipleMetricCriteria odata.type."

Any thoughts on how to encode the order of deployment explicitly directly from Farmer? If there is a provision for this in Farmer already, I haven't found it.

OutOfScopeia avatar Jun 10 '24 14:06 OutOfScopeia