资源所有者行动小组

Action Groups to Resource Owners

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

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

目的是创建一个操作组,向所有者组中的每个人发送电子邮件。查看模板,对于所有接收者来说它也是空白的,没有指示实际定义它需要发送到的 "role" 的位置。

任何帮助将不胜感激。

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

应该是这样的:

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

你可以找到microsoft.insights actionGroups template reference,这是我这边的模板。

{
    "$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"
      }
    ]
  }
}
    ]
}