azure-eventgrid - ARM 隐式创建事件网格系统主题。事件网格订阅如何附加到自定义事件网格主题
问题描述
我在通过 ARM 部署资源时遇到问题。我有 2 个查询。
查询 1。为什么下面这个 Linked ARM 隐式创建了 Event Grid System Topic 这个 Linked ARM 仅用于获取 azure function { "$schema": "https://schema.management.azure.com/schemas/2015-01-01 的触发 URL /deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "functionAppName": { "type": "String" } }, "variables": { "sitesWebApiVersion": "2016-08 -01" }, "resources": [], "outputs": { "triggerUrl": { "type": "String", "value": "[listsecrets(resourceId('Microsoft.Web/sites/functions',参数('functionAppName')、'NPEventGridDataProcessor')、变量('sitesWebApiVersion')).trigger_url]" } } }
Query2 在 ARM 中,我如何创建附加到显式创建的自定义事件主题的事件订阅。如以下主要 ARM 代码片段所示,事件订阅附加到事件网格系统主题中不需要。但我想将它添加到自定义事件网格主题。
{ "apiVersion": "2020-06-01", "scope": "[format('Microsoft.EventGrid/topics/{0}', variables('eventGridName'))]", "name": "[variables ('eventGridSubwebhookName')]", "type": "Microsoft.EventGrid/eventSubscriptions", "tags": { "displayName": "Webhook Subscription" }, "dependsOn": ["[resourceId('Microsoft.EventGrid/topics /', variables('eventGridName'))]", "[resourceId('Microsoft.Resources/deployments/', variables('hackForGettingTriggerUrl'))]" ], "properties": { "destination": { "endpointType" :“WebHook”,“属性”:{“endpointUrl”:“[参考(变量('hackForGettingTriggerUrl'))。输出.triggerUrl.value]" } } } } ]
解决方案
如果您想为自定义主题创建事件网格订阅,请参考以下模板
"resources": [
{
"type": "Microsoft.EventGrid/topics",
"apiVersion": "2020-06-01",
"name": "[parameters('eventGridTopicName')]",
"location": "[parameters('location')]"
},
{
"type": "Microsoft.EventGrid/eventSubscriptions",
"apiVersion": "2020-06-01",
"scope": "[format('Microsoft.EventGrid/topics/{0}', parameters('eventGridTopicName'))]",
"name": "[parameters('eventGridSubscriptionName')]",
"properties": {
"destination": {
"endpointType": "WebHook",
"properties": {
"endpointUrl": "[parameters('eventGridSubscriptionUrl')]"
}
}
},
"dependsOn": [
"[resourceId('Microsoft.EventGrid/topics', parameters('eventGridTopicName'))]"
]
}
],
推荐阅读
- html - 如何批量删除段落中的不同文本值
- android - Firemonkey TMemo OnChangeTracking Android 上的奇怪行为
- python - 根据容器中的元素获取副标题文本
- flutter - 多供应商颤振
- testng - 如果测试失败,带有 dataProvider 的 TestNG 会跳过测试
- swift - Firebase 规则:权限被拒绝
- angular - 为 Angular Material 步进器中的一步分配全宽
- javascript - JavaScript 循环嵌套数组
- git - 如何以特定格式转换 git log --name-only?
- python - 三变量相关性分析:将一个变量分类为区间,以实现其他两个变量之间更好的相关性