Azure CLI 更新具有自定义属性的指标警报

问题描述 投票:0回答:1

我在天蓝色中有一系列指标警报,我想将自定义属性添加到操作组。 我已手动将一些测试数据添加到其中一个警报中,当我使用 CLI 提取此警报的详细信息时,我可以在返回的 JSON 中看到数据:

az monitor metrics alert show --resource-group 'MyGroup' --name 'MyAlert'
{
  "actions": [
    {
      "actionGroupId": "/subscriptions/XXX/resourceGroups/MyGroup/providers/microsoft.insights/actionGroups/MyAlert",
      "webHookProperties": {
        "ResourceName": "MyResourceName",
        "TestData": "test"
      }
    }
  ],

我正在尝试使用更新命令将类似的数据添加到其他警报,但我看不到任何有关如何将这些 WebHookProperties 添加到现有警报的示例。

az monitor metrics alert update --resource-group --name 'MyAlert' --add actions ['Test','Test']

非常感谢任何帮助!

azure azure-cli azure-alerts
1个回答
0
投票

我正在尝试使用更新命令将类似的数据添加到其他警报,但我看不到任何有关如何将这些 WebHookProperties 添加到现有警报的示例。

这是将

WebHookProperties
更新为现有警报的命令。

az monitor metrics alert update --resource-group 'RG-Name' --name 'MyAlert' --set actions[0].webHookProperties='{"ResourceName": "Venkat", "TestData": "Test"}'

输出:

enter image description here

运行上述命令后,使用下面的cmd会显示WebHookProperties

 az monitor metrics alert show --resource-group 'RG-Name' --name 'MyAlert'

enter image description here

参考: az 监控指标警报更新

© www.soinside.com 2019 - 2024. All rights reserved.