简体   繁体   English

如何使用 arm 模板为事件网格域主题创建事件订阅

[英]How to create Event Subscription for Event Grid Domain Topic using arm template

I want to use the arm template to create the Event Subscription for the Event Grid Domain Topic .我想使用 arm 模板为事件网格域主题创建事件订阅 It's ok when I create Event Grid Domain and Event Grid Domain Topic but when I try to create the Event Subscription to listen to messages from Event Grid Domain Topic .当我创建Event Grid DomainEvent Grid Domain Topic时没问题,但是当我尝试创建Event Subscription以收听来自Event Grid Domain Topic的消息时。 It always fails.它总是失败。 I think I defined the wrong " scrope " or " dependsOn ".我想我定义了错误的“ scrope ”或“ dependsOn ”。 Actually, I can't find the document or tutorial to create the Event Subscription for Event Grid Domain Topic .实际上,我找不到为事件网格域主题创建事件订阅的文档或教程。 Almost document guide the way to create the Event Subscription for Event Grid Topic .几乎文档指导如何为事件网格主题创建事件订阅

Thanks for support谢谢你的支持

This is my arm template这是我的 arm 模板

{
  "type": "Microsoft.EventGrid/eventSubscriptions",
  "apiVersion": "2021-06-01-preview",
  "name": "[parameters('eventSubscription')]",
  "scope": "[format('Microsoft.EventGrid/domains/topics/{0}', concat(variables('eventGridDomainName'), '/',parameters('topic')))]",
  "properties": {
    "deadletterdestination": {
      "endpointType": "StorageBlob",
      "properties": {
        "blobContainerName": "parameters('containerName')",
        "resourceId": "/subscriptions/{subscriptions}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{containerName}"
      }
    },
    "destination": {
      "endpointType": "WebHook",
      "properties": {
        "endpointUrl": "string"
      }
    },
    "eventDeliverySchema": "EventGridSchema",
    "filter": {
      "advancedFilters": [],
      "enableAdvancedFilteringOnArrays": true
    },
    "labels": []
  },
  "dependsOn": [
   "[resourceId('Microsoft.EventGrid/domains/topics',variables('eventGridDomainName'),parameters('topic')]"
  ]
}

I had to modify the scope a bit to get it working, take a look at the snippet below.我必须稍微修改 scope 才能使其正常工作,看看下面的代码片段。

  "scope": "[concat('Microsoft.EventGrid/domains', '/', parameters('domains_azdomaineg_name'), '/', 'topics', '/', parameters('topicName'))]"

/ /

{
      "type": "Microsoft.EventGrid/eventSubscriptions",
      "apiVersion": "2020-06-01",
      "name": "[concat(parameters('domains_azdomaineg_name'), 'topic-dommain-subscription')]",
      "dependsOn": [
        "[resourceId('Microsoft.EventGrid/domains', parameters('domains_azdomaineg_name'))]",
        "[resourceId('Microsoft.EventHub/namespaces/eventHubs', parameters('eventHubNamespace'), parameters('eventHubName'))]"
      ],
      "properties": {
        "destination": {
          "endpointType": "EventHub",
          "properties": {
            "resourceId": "[resourceId('Microsoft.EventHub/namespaces/eventhubs', parameters('eventHubNamespace'), parameters('eventHubName'))]"
          }
        },
        "filter": {
          "includedEventTypes": [
            "first, last"
          ],
          "advancedFilters": [
            {
              "key": "dataversion",
              "operatorType": "StringIn",
              "values": [
                "test"
              ]
            }
          ]
        }
      },
      "scope": "[concat('Microsoft.EventGrid/domains', '/', parameters('domains_azdomaineg_name'), '/', 'topics', '/', parameters('topicName'))]"

    }
  ]
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 事件网格订阅事件将传递失败 - Event Grid Subscription event going to delivery failure Azure 事件网格主题的应用程序网关后端池 - Azure Application Gateway backendpool to Event Grid Topic 是否可以为 Azure Function 部署槽创建 Azure 存储事件网格订阅? - Is it possible to create an Azure Storage Event Grid Subscription to an Azure Function deployment slot? 是否可以在 azure function 应用程序中创建主题订阅? - Is it possible to create a topic subscription in an azure function app? 使用 gcloud 命令部署事件弧触发第二代云 function 时如何指定 pubsub 主题 - How to specify pubsub topic when deploying event arc triggered 2nd gen cloud function using gcloud command 如何使用ARM模板为azure自动化设置账户运行? - How to set run as account for azure automation using ARM template? 如何在 amazon aws 中创建新的预定事件? - how to create new scheduled event in amazon aws? 如何在 CloudFormation 脚本上添加 email 订阅 SNS 主题? - How to add email subscription of SNS Topic on CloudFormation Script? 是否可以在 cloudformation 模板中使用多个 email 收件人创建 SNS 主题? - Is to possible to create SNS topic with multiple email Recipients in cloudformation template? 在 ARM 模板参数文件中使用引用函数 - Using reference funtion in an ARM template parameter file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM