'Is there any way to pass the alert dimension values from Azurepipeline to the arm template
I got stuck when I tried to automate the metric alert rule creation using Azure Pipeline which in backend will update parameters.json file with the runtime parameter values and will be used by the deployment template.
The rest of the things I could convert in the pipeline yaml file. But I got stuck with how to pass the runtime parameter values for the dimensions which will be different for different metrics
"criteria": {
"allOf": [
{
"threshold": 1,
"name": "Metric1",
"metricNamespace": "Microsoft.DocumentDB/databaseAccounts",
"metricName": "TotalRequestUnits",
"dimensions": [
{
"name": "DatabaseName",
"operator": "Include",
"values": [
"mydb"
]
},
{
"name": "StatusCode",
"operator": "Include",
"values": [
"429"
]
}
],
So here looking for a way to replace this content in the deployment template json file (not sure what kind of parameter type need to define) and the corresponding values need to be updated in the parameters.json file from the runtime parameter of Azure Pipeline
Solution 1:[1]
You can maybe try passing an array into dimensions parameter.
Like this:
"dimensions": {
"type": "array",
"defaultValue": [],
"metadata": {
"description": "The dimensions to filter the metric"
}
}
and then pass the value in the parameters.json file
Or you can set the value in the default value
"dimensions": {
"type": "array",
"defaultValue": [
{
"name": "EntityName",
"operator": "Include",
"values": [
"test-dev1",
"test-dev2",
]
}
],
"metadata": {
"description": "The dimensions to filter the metric"
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | kqly |
