Azure / Azure/azure-cli

az monitor metrics alert dimension create does not allow StartsWith operator

Open
#18,152 1 comment 0 reactions 1 assignee Claimed by @kairu-ms View on GitHub
act-observability-squad feature-request Monitor p1_e2
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

**Is your feature request related to a problem? Please describe.**
Currently the dimension object only supports Include or Exclude operators when created through Azure CLI/API. This limits the functionality compared to when you create an alert through Azure Portal, which provides an extra operator StartsWith [that is not available on Azure CLI](https://docs.microsoft.com/en-us/cli/azure/monitor/metrics/alert/dimension?view=azure-cli-latest).

**Describe the solution you'd like**
I would like that the StartsWith operator is available on Azure CLI/API.

Example of showing an alert with StartsWith operator created in Azure Portal.
```
...
"criteria": {
"additionalProperties": null,
"allOf": [
{
"additionalProperties": null,
"criterionType": "StaticThresholdCriterion",
"dimensions": [
{
"name": "podName",
"operator": "StartsWith",
"values": [
"xpto"
]
}
],
"metricName": "cpuExceededPercentage",
"metricNamespace": "insights.container/containers",
"name": "Metric1",
"operator": "GreaterThanOrEqual",
"skipMetricValidation": null,
"threshold": 1.0,
"timeAggregation": "Count"
}
],
"odataType": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria"
},
...
```

**Describe alternatives you've considered**
Do it manually through Azure Portal.

**Additional context**
N/A

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.