Event subscription by ARM template for topic with EndpointType as AzureFunction

后端 未结 2 1287
孤街浪徒
孤街浪徒 2021-01-22 13:27

I am trying to create an event grid topic subscription with \"endpointType\": \"AzureFunction\". It is giving following error: -

\"error\

相关标签:
2条回答
  • 2021-01-22 13:40

    Jakob's suggestion for changing api version worked for me with change in resourceId. Here is my modified working template: -

    {
          "name": "[concat(variables('eventGridTopicName'), '/Microsoft.EventGrid/', variables('myFuncName'))]",
          "type": "Microsoft.EventGrid/topics/providers/eventSubscriptions",
          "apiVersion": "2020-01-01-preview",
          "location": "[parameters('location')]",
          "properties": {
            "topic": "[concat('/subscriptions/', parameters('subscriptionId'),'/resourcegroups/', parameters('resourceGroupName'), '/providers/Microsoft.EventGrid/topics/', variables('eventGridTopicName'))]",
            "destination": {
              "endpointType": "AzureFunction",
              "properties": {
                "resourceId": "[concat('/subscriptions/', parameters('subscriptionId'),'/resourcegroups/', parameters('resourceGroupName'), '/providers/Microsoft.Web/sites/', variables('funcAppName'), '/functions/' , variables('myFuncName'))]",
                "maxEventsPerBatch": 1,
                "preferredBatchSizeInKilobytes": 64
              }
            },
            "filter": {
              "advancedFilters": [
                {
                  "operatorType": "StringIn",
                  "key": "eventType",
                  "values": [
                    "xyzEvent"
                  ]
                },
                {
                  "operatorType": "StringIn",
                  "key": "subject",
                  "values": [
                    "xyzEventReceived"
                  ]
                }
              ]
            },
            "labels": [],
            "eventDeliverySchema": "EventGridSchema"
          },
          "dependsOn": [
            "[variables('eventGridTopicName')]"
          ]
        }
    
    0 讨论(0)
  • 2021-01-22 13:48

    Yes ! found this when I had same issue! ..

    Update! found an example that uses another API version and it seems to work beter, now my issue is that there is no code on it when deploying first time, so I need to break the template into two and deploy content in btween (or deploy content via template ofc).

    "apiVersion": "2020-01-01-preview",

    https://blog.brooksjc.com/2019/07/19/arm-template-for-event-grid-integration-with-a-new-azure-function/

    Update 2, after adding the content and rerunning the template, it work fine!

    here is my full code for my storage trigger

    {
                "name": "[concat(variables('storageAccountName'), '/Microsoft.EventGrid/coreCostManagementExport')]",
                "type": "Microsoft.Storage/storageAccounts/providers/eventSubscriptions",
                "apiVersion": "2020-01-01-preview",
                "dependsOn": [
                    "[resourceId('Microsoft.Storage/storageAccounts',variables('storageAccountName'))]",
                    "[resourceId('Microsoft.Web/sites',parameters('functionAppName'))]"
                ],
                "properties": {
                    "topic": "[resourceId('Microsoft.Storage/storageAccounts',variables('storageAccountName'))]",
                    "destination": {
                        "endpointType": "AzureFunction",
                        "properties": {
                            "resourceId": "[resourceId('Microsoft.Web/sites/functions/', parameters('functionAppName'), 'QueueUsageOnExport')]",
                            "maxEventsPerBatch": 1,
                            "preferredBatchSizeInKilobytes": 64
                        }
                    },
                    "filter": {
                        "subjectBeginsWith": "/blobServices/default/containers/usage",
                        "subjectEndsWith": ".csv",
                        "includedEventTypes": [
                            "Microsoft.Storage.BlobCreated"
                        ],
                        "advancedFilters": [
                        ]
                    },
                    "labels": [
                    ],
                    "eventDeliverySchema": "EventGridSchema"
                }
            }
    
    
    0 讨论(0)
提交回复
热议问题