简体   繁体   中英

ARM template deployment fails for Azure Function Event Grid Subscription to custom topic

I can successfully deploy a Custom Event Grid Topic and Azure Function app via ARM templates. After that, in a separate ARM deployment, an Azure Function Event Grid Subscription to this custom topic fails at validation stage with the following error:
The template resource 'Microsoft.EventGrid/topics/EventGridCustomTopicName/providers/Microsoft.EventGrid/eventSubscriptions/EventGridSubscriptionName' cannot reference itself.

'EventGridSubscriptionName' is the same as the name of my function app, if that matters.

Again: I have a Topic and a Function app already created.

I have gone through the official examples and documentation , but it does not work for me nevertheless.

Here is my template defined as a root resource:

{
  "name": "[concat(parameters('EventGridCustomTopicName'), '/Microsoft.EventGrid/', variables('EventGridSubscriptionName'))]",
  "type": "Microsoft.EventGrid/topics/providers/eventSubscriptions",
  "location": "[resourceGroup().location]",
  "apiVersion": "2018-01-01",
  "dependsOn": [
    "[parameters('FunctionAppName')]"
  ],
  "properties": {
    "destination": {
      "endpointType": "WebHook",
      "properties": {
        "endpointUrl": "[concat('https://', parameters('FunctionAppName'), '.azurewebsites.net/admin/extensions/EventGridExtensionConfig?functionName=TopicSubscriber&code=', variables('funcCode'))]"
      }
    },
    "filter": {
      "includedEventTypes": [
        "All"
      ]
    }
  }
}

Any help is highly appreciated!

i think whats happening the name is ambiguous and it cannot understand what to depends on. try doing something like this:

"dependsOn": [
    "[resourceId('Microsoft.Web/sites', parameters('FunctionAppName'))]"
],

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM