1

在 Azure 门户上创建操作组时,您可以选择在操作组上创建操作以通过电子邮件发送 Azure 资源管理器角色,例如所有者。

尝试自动化每个订阅/资源组的操作组,我找不到任何有关如何通过 Powershell 或 CLI 创建此类接收器的文档。有标准的 EmailReceiver 和其他,但没有特定于特定资源组的角色。

目的是创建一个操作组,向所有者组中的每个人发送电子邮件。查看模板,对于所有接收者来说,它也是空白的,没有说明它实际上定义了它需要发送到的“角色”。

任何帮助将不胜感激。

在此处输入图像描述

4

1 回答 1

2

如果我正确理解你。您可以尝试使用armRoleReceivers参数创建电子邮件 ARM 角色。执行此操作时,您可以将值设置为与操作组中的名称和特定name值相同的值。例如,如果要设置此的内置所有者角色,则应设置roleIdemailReceiversroleId 8e3af657-a8ff-443c-a75c-2fe8c4bcb635

应该是这样的:

"armRoleReceivers": [
  {
    "name": "string",
    "roleId": "8e3af657-a8ff-443c-a75c-2fe8c4bcb635"
  }
]

您可以找到microsoft.insights actionGroups 模板参考,这是我身边的一个模板。

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
    "actionGroupName": {
      "type": "string",
      "metadata": {
        "description": "Unique name (within the Resource Group) for the Action group."
      }
    },
    "actionGroupShortName": {
      "type": "string",
      "metadata": {
        "description": "Short name (maximum 12 characters) for the Action group."
      }
    }
  },
    "resources": [
{
  "name": "[parameters('actionGroupName')]",
  "type": "microsoft.insights/actionGroups",
  "apiVersion": "2018-09-01",
  "location": "Global",
  "properties": {
    "groupShortName": "[parameters('actionGroupShortName')]",
    "enabled": true,
    "emailReceivers": [
      {
        "name": "contosoEmail",
        "emailAddress": "devops@contoso.com"
      }
    ],
    "smsReceivers": [
      {
        "name": "contosoSMS",
        "countryCode": "1",
        "phoneNumber": "555555"
      }
    ],
    "armRoleReceivers": [
      {
        "name": "contosoEmail",
        "roleId": "8e3af657-a8ff-443c-a75c-2fe8c4bcb635"
      }
    ]
  }
}
    ]
}

在此处输入图像描述

于 2019-01-09T10:25:58.300 回答