ARM 模板部署 - 逻辑应用程序到事件网格主题和多个订阅调用更多逻辑应用程序

ARM Template deployment - Logic App to Event Grid Topic and multi Subscriptions calling more Logic Apps

我正在努力将事件网格订阅、事件网格主题和逻辑应用程序添加到单个 ARM 模板中。 首先,在订阅中我无法引用 url 也正在部署的逻辑应用程序:

 "name": "[concat(parameters('topics_mt_x_eun_ex_rate_egt_name'), '/Microsoft.EventGrid/', parameters('subscription_name'))]",
        "type": "Microsoft.EventGrid/topics/providers/eventSubscriptions",
        "location": "[parameters('location')]",
        "tags": "[parameters('resourceTags')]",
        "apiVersion": "2018-01-01",
        "properties": {
            "destination": {
                "endpointType": "WebHook",
                "properties": {

                    "endpointUrl": "[listCallbackUrl(resourceId('Microsoft.Logic/workflows/triggers', parameters('TargetLogicAppName'), 'manual'), '2016-06-01').value]"
                }
            },
            "filter": {
                "includedEventTypes": [
                    "All"
                ]
            }
        },
        "dependsOn": [
            "[parameters('Topics')]",
            "[parameters('TargetLogicAppName')]"
        ]

我收到以下错误:

InvalidRequest:api 版本 2019-06-01 不支持 IpFiltering。

所以我的主要问题是,我怎样才能让它发挥作用?

此外,我对 运行 我的主要部署模板中的上述内容感到满意,但是是否有可能 link 主要逻辑应用程序中的 Publish EventGrid 操作连接到事件网格主题(它需要 SAS 令牌以及主题 url)?

解决了我遇到的两个问题。

设置变量:

"TargetLogicApp": {
        "name": "[parameters('workflows_mt_sample_log_name')]",
        "resourceId": "[resourceId('Microsoft.Logic/workflows', parameters('TargetLogicAppName'))]",
        "triggerId": "[resourceId('Microsoft.Logic/workflows/triggers', parameters('TargetLogicAppName'), 'manual')]"
    }

然后在 EventGridTopic 资源里面:

{
        "name": "[concat(parameters('topic'), '/Microsoft.EventGrid/', parameters('subscription_name'))]",
        "type": "Microsoft.EventGrid/topics/providers/eventSubscriptions",
        "location": "[parameters('location')]",
        "tags": "[parameters('resourceTags')]",
        "apiVersion": "2020-04-01-preview",
        "properties": {
            "destination": {
                "endpointType": "WebHook",
                "properties": {
                    "endpointUrl": "[listCallbackUrl(variables('TargetLogicApp').triggerId, '2019-05-01').value]"
                }
            },
            "filter": {
                "includedEventTypes": [
                    "Microsoft.Resources.ResourceWriteFailure",
                    "Microsoft.Resources.ResourceWriteSuccess"
                ]
            }
        },
        "dependsOn": [
            "[parameters('Topics')]",
            "[parameters('targetLogicApp').name]"
        ]
    },

需要启用目标逻辑应用才能正确分配订阅。

在触发的逻辑应用中应用 API 事件网格发布连接器:

{
        "type": "Microsoft.Web/connections",
        "apiVersion": "2016-06-01",
        "name": "[parameters('connections_azureeventgridpublish_name')]",
        "location": "[parameters('location')]",
        "tags": "[parameters('resourceTags')]",
        "properties": {
            "displayName": "conn-exrate-egt",
            "customParameterValues": {},
            "parameterValues": {
                "endpoint": "[reference(variables('eventGridTopic').name).endpoint]",
                "api_key": "[listKeys(variables('eventGridTopic').resourceId, '2020-04-01-preview').key1]"
            },
            "api": {
                "id": "[concat('/subscriptions/x/providers/Microsoft.Web/locations/northeurope/managedApis/', parameters('connections_azureeventgridpublish_name'))]"
            }
        }
    },