-1

I have facing issue on deploying a resources via ARM . I have 2 queries .

Query 1 . Why this below Linked ARM implicitly created Event Grid System Topic This Linked ARM is only used to get trigger URL of azure function { "$schema": "https://schema.management.azure.com/schemas/2015-01-01/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', parameters('functionAppName'), 'NPEventGridDataProcessor'), variables('sitesWebApiVersion')).trigger_url]" } } }

Query2 In ARM how I create Event Subscription that attach to explicitly created custom Event Topic. As see the below the master ARM code snippet , event subscription attach unwanted to the Event Grid System Topic . But I want to add it on Custom Event Grid topic .

{ "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", "properties": { "endpointUrl": "[reference(variables('hackForGettingTriggerUrl')).outputs.triggerUrl.value]" } } } } ]

SK-logic
  • 9,605
  • 1
  • 23
  • 35

1 Answers1

0

If you want to create event gird subscription for custom topic, please refer to the following template

"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'))]"
      ]
    }
  ],
Jim Xu
  • 21,610
  • 2
  • 19
  • 39