[@azure/arm-monitor] containsAny support for ActivityLogAlertLeafCondition
See original GitHub issueFeature request
In order to create and update Service Health Activity Log Alerts with containsAny
property inside allOf
condition the SDK needs to support the property.
It seems that the SDK uses apiVersion: 2017-04-01
which does not yet support containsAny
property. Azure portal seems to already use apiVersion: 2020-06-01
which does support it.
This results in a scenario where I can manually create alert in the portal with containsAny
property inside allOf
condition, which can be returned with the SDK by calling MonitorClient(...).activityLogAlerts.get(resourceGroupName, alertName)
:
"condition": {
"allOf": [
...
{
"field": "properties.impactedServices[*].ImpactedRegions[*].RegionName",
"equals": null,
"containsAny": [
"Global",
"West Europe",
],
"odata.type": null
}
],
"odata.type": null
}
But if I want to create (or update) an alert with containsAny
rule with the SDK it isn’t possible. As a workaround I tried to create alert by using equals
property in a following condition:
{
"field": "properties.impactedServices[*].ImpactedRegions[*].RegionName",
"equals": "West Europe",
}
but when shown in the portal it shows that “Region(s)” is set to “all” and when trying to open the alert for modification the ui shows an error page with “Unexpected error”.
As a workaround I created alerts that are scoped to my resource groups and only use following condition:
{
field: 'category',
equals: 'ServiceHealth'
}
This should work fine, but it would be great if it would be possible to create alerts with containsAny
conditions and also update them with the SDK.
Additional context
- Monitor rest api documentation that supports
containsAny
: https://docs.microsoft.com/en-us/rest/api/monitor/activity-log-alerts/create-or-update - Related issue in the go sdk: https://github.com/Azure/azure-sdk-for-go/issues/4485
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:10 (5 by maintainers)
First of all, thank you for the fast fix!
Unfortunately I cannot test the changes due my summer vacation - but I briefly checked the source code for the beta and it seems to include the changes that were requested in the issue!
@eero3 I think this is a valid issue and we’ll contact the service team to update and release our package to the latest one.