I am trying to create two Event Grid Subscriptions to an Azure Function App containing two EventGridTrigger functions, among other functions for an existing Event Grid System Topic of type Microsoft.Communication.CommunicationServices.
I have tried using both Bicep and Azure Powershell to do it and I am getting the error below:
Destination endpoint not found. Resource details: resourceId: /subscriptions/my-subscription-id/resourceGroups/rg-cc-dev/providers/Microsoft.Web/sites/my-func/functions/FunctionEmailDeliveryReportReceived. Resource should pre-exist before attempting this operation.
For example, this is the Azure Powershell code I am using to create the event grid system topic subscription:
# get the parent system topic
$systemTopic = Get-AzEventGridSystemTopic -ResourceGroupName my-rg-acs-dev -name egst-acs-dev
# get the function app containing the EventGridTrigger functions
$func = (Get-AzFunctionApp -ResourceGroupName rg-cc-dev -Name my-func)
# compose the resourceId of one of the EventGridTrigger functions
$funcEmailDelivery = $func.Id + "/functions/FunctionEmailDeliveryReportReceived"
# create an in-memory representation of the event grid azure function event subscription destination object
$func_evdo = New-AzEventGridAzureFunctionEventSubscriptionDestinationObject -MaxEventsPerBatch 1 -PreferredBatchSizeInKilobyte 64 -ResourceId $funcEmailDelivery
# create the event grid system topic subscription
New-AzEventGridSystemTopicEventSubscription `
-EventSubscriptionName evgs-acs-email-delivery-dev `
-ResourceGroupName my-rg-acs-dev `
-SystemTopicName $systemTopic.Name `
-Destination $func_evdo `
-EventDeliverySchema CloudEventSchemaV1_0 `
-FilterEnableAdvancedFilteringOnArray `
-FilterIncludedEventType $includedEventTypesForEmailDelivery `
-RetryPolicyMaxDeliveryAttempt 10 `
-RetryPolicyEventTimeToLiveInMinute 1440
NOTE: The Azure Function App already exists, it is started and I can see all the functions it contains. I also tested an HttpTrigger function contained in the Azure Function App and it works, i.e. it accepts the request and provides the correct response.
I prefer to create the event grid system topic subscription either declaratively using Bicep or imperatively using Azure Powershell, however nothing works.
Can anyone please shed some light on what is going on?
Panayotis Tzedakis is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.