使用 ARM 模板的带有静态 Header 的 WEBHOOK 类型的事件订阅

Event subscription of type WEBHOOK with static Header using ARM template

问题区域:

我尝试按照官方文档使用 ARM 模板创建新的事件网格主题订阅。

脚本 运行 在 PowerShell 终端中运行良好,但我无法在 Azure 门户中的指定主题下找到正在生成的事件订阅。

样本JSON模板:

{
  "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "resources": [
    {
      "type": "Microsoft.EventGrid/eventSubscriptions",
      "apiVersion": "2021-06-01-preview",
      "name": "Subscription_1",
      "properties": {
        "destination": {
          "topic": "/subscriptions/{Subscription Id})/resourceGroups/{Resource group name}/providers/Microsoft.EventGrid/topics/{Topic name}}",
          "endpointType": "WebHook",
          "properties": {
              "endpointUrl": "{Endpoint URL}",
              "deliveryAttributeMappings": [
                  {
                      "name": "test",
                      "type": "Static",
                      "properties": {
                          "value": "test"
                      }
                  }
              ]
          }
        },
        "eventDeliverySchema": "EventGridSchema",
        "filter": {
          "advancedFilters": [],
          "enableAdvancedFilteringOnArrays": true
        },
        "labels": []      
      }
    }
  ]
}

解决方法:

通过如下更改 arm-template 中的 'type' 和 'naming convention' 来实现此目的:

"type": "Microsoft.EventGrid/topics/providers/eventSubscriptions",
"apiVersion": "2021-06-01-preview",
"name": "{Topic Name}/ Microsoft.EventGrid/ {Subsctription Name}",