简体   繁体   中英

Error creating Event grid topic subscription of type 'WEBHOOK' with 'deliveryAttributeMappings' static Header using arm-template

Problem area :

I tried creating a new event grid topic subscription using an ARM Template following the official documentation.

Script ran fine within PowerShell terminal but I couldn't find the event subscription being generated under the specified topic in the azure portal.

Sample JSON Template :

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

Solution :

Got this working by changing the 'type' and the 'naming convention' in the arm-template as below:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM