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

时间:2020-05-01 18:11:44

标签: azure azure-logic-apps azure-resource-manager azure-eventgrid

我正在努力将事件网格订阅,事件网格主题和逻辑应用程序添加到单个ARM模板中。 首先,在“订阅”中,我无法引用该URL,而该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。

所以我的主要问题是,如何使它工作?

此外,我对在主部署模板中仅运行上述内容感到满意,但是是否可以在主Logic App中链接Publish EventGrid操作以连接到事件网格主题(它也需要SAS令牌)作为主题网址)?

1 个答案:

答案 0 :(得分:0)

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

设置变量:

"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]"
        ]
    },

需要启用目标Logic Apps,才能正确分配订阅。

要在触发的Logic App中将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'))]"
            }
        }
    },
相关问题