Can't successfully use Azure Function as a Handler/Endpoint when creating Event Grid Subscription

Yasmin Radwan 20 Reputation points Microsoft Employee
2024-02-13T06:03:20.6066667+00:00

Hi, I am trying to create an Event Grid Subscription on an Event Grid Partner Topic. I am trying to use Azure Function as the Handler/Endpoint. I am getting the following error when I try to create: Deployment has failed with the following error: {"code":"Endpoint validation","message":"Destination endpoint not found. Resource details: resourceId: xxxxxxx<Azure Function Name> Resource should pre-exist before attempting this operation.

I confirmed that my function is deployed to Production and has no errors. I tried pushing data to the function using Postman and it worked (can see the function was triggered on the Azure Portal) I am not sure if there is extra permissions/configurations/role assignments that need to be updated? I assigned my function's identity the following role assignments on the Partner Topic RBAC: as: Contributor, EventGrid Contributor, EventGrid TopicSpaces Subscriber Would appreciate any insights/help. Thanks!

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,365 questions
Azure
Azure
A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.
992 questions
Azure Event Grid
Azure Event Grid
An Azure event routing service designed for high availability, consistent performance, and dynamic scale.
322 questions
{count} votes

Accepted answer
  1. JananiRamesh-MSFT 22,121 Reputation points
    2024-02-15T05:00:23.73+00:00

    @Yasmin Radwan I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others", I'll repost your solution in case you'd like to "Accept" the answer.

    Issue: You were getting the following error when I try to create Event Grid Subscription on an Event Grid Partner Topic with Azure Function as an Endpoint: Deployment has failed with the following error: {"code":"Endpoint validation","message":"Destination endpoint not found. Resource details: resourceId: xxxxxxx<Azure Function Name> Resource should pre-exist before attempting this operation.

    Solution: You had to change the function's binding parameter to be CloudEvent instead of EventGridEvent and also installed the NuGet package: Microsoft.Azure.WebJobs.Extensions.EventGrid -Version 3.3.1 via Visual Studio, as your function is deployed to Azure Portal as a C# project.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Yasmin Radwan 20 Reputation points Microsoft Employee
    2024-02-14T06:08:55.96+00:00

    I was able to identify the root cause for the error. I had to change the function's binding parameter to be CloudEvent instead of EventGridEvent. I also had to install the NuGet package: Microsoft.Azure.WebJobs.Extensions.EventGrid -Version 3.3.1 via Visual Studio, as my function is deployed to Azure Portal as a C# project. Accordingly, I was able to successfully create the Event Subscription to use the deployed Azure Function.

    0 comments No comments