Reputation: 148
I am struggling adding the Event Grid Subscriptions, event grid topics and logic apps into a single ARM template. Firstly within the Subscription I cannot reference the url a Logic App that is also being deployed:
"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')]"
]
I receive the following error:
InvalidRequest: IpFiltering is unsupported in api version 2019-06-01.
So my main question is, how can I get this to work?
Additionally I am content with running just the above inside my main deployment template, but is it at all possible to link the Publish EventGrid action inside the main Logic App to connect to the Event Grid Topic (it requires a SAS Token as well as the topics url)?
Upvotes: 1
Views: 1319
Reputation: 148
Resolved both problems I had.
Setup variable:
"TargetLogicApp": {
"name": "[parameters('workflows_mt_sample_log_name')]",
"resourceId": "[resourceId('Microsoft.Logic/workflows', parameters('TargetLogicAppName'))]",
"triggerId": "[resourceId('Microsoft.Logic/workflows/triggers', parameters('TargetLogicAppName'), 'manual')]"
}
And then inside the EventGridTopic resource:
{
"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]"
]
},
The target Logic Apps need to be enabled for the subscription to be correctly assigned.
To apply the API Connector for Event Grid Publish within triggered Logic App:
{
"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'))]"
}
}
},
Upvotes: 3