Event Grid Blob Webhook for Azure Functions

Derek 0 Reputation points
2025-02-21T13:51:17.2133333+00:00

What part of the Azure functions services handles requests to the https://<FUNCTION_APP_NAME>.[azurewebsites.net/runtime/webhooks/blobs?functionName=Host.Functions.<FUNCTION_NAME>&code=]<BLOB_EXTENSION_KEY> endpoint referenced in this MS Learn Article?  Is it part of the Azure Functions Runtime docker image or is there some other package required to handle the post from Event Grid?

I have my own functions runtime running in Azure Kubernetes Service. The queue triggers work, the timer trigger works, and even the simple blob trigger at low volumes, but when I attempt to setup the Event Grid based blob trigger, I get 404s.

# curl -o - -I 'http://localhost/runtime/webhooks/blobs?functionName=Host.Functions.process_log_file&code=xxx'
HTTP/1.1 404 Not Found
Date: Fri, 21 Feb 2025 13:50:14 GMT
Server: Kestrel
#
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,473 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Sampath 510 Reputation points Microsoft Vendor
    2025-02-26T12:40:22.2966667+00:00

    Hello @Derek,

    In a local or Docker environment, the Event Grid URL for Azure Functions will be:

    http://localhost:7071/runtime/webhooks/EventGrid?functionName={functionname}
    

    There will be no key or code until the function is deployed to Azure. After deployment, the Event Grid URL/Azure Functions webhook URL will be:

    https://FunctionAppName.azurewebsites.net/runtime/webhooks/EventGrid?functionName=EventGridTrigger1&code=3
    

    Event Grid key

    Refer to this documentation for Azure Functions on Kubernetes with KEDA.

    Testing Locally / On Docker:

    I tested a sample Azure Function using Python with an EventGridTrigger named EventGridTrigger1.

    Steps to Test Using Postman

    1. Open Postman and set the method to POST.
    2. Enter the URL:
         http://localhost:7071/runtime/webhooks/EventGrid?functionName=EventGridTrigger1
      
    3. Go to the Headers tab and add:
      • Content-Type: application/json
      • aeg-event-type: Notification
    4. Go to the Body tab, select raw, and paste the following JSON:
    
    [
    
      {
    
        "id": "1234",
    
        "eventType": "recordInserted",
    
        "subject": "/myapp/orders",
    
        "eventTime": "2024-02-26T10:00:00Z",
    
        "data": {
    
          "orderId": "5678",
    
          "status": "created"
    
        },
    
        "dataVersion": "1.0"
    
      }
    
    ]
    
    

    Postman Setup

    Connecting Storage Account Events to the Function App

    After deploying to Azure, you need to connect Storage Account Events to the Function App.

    Refer to this documentation to learn how to push Blob Storage Events to an Azure Storage Table using an Azure Function App.

    Event Grid Trigger Behavior

    The EventGridTrigger is triggered only for the Event Types selected.

    Event Types

    For example, if a blob is uploaded to Azure Storage, the corresponding events are sent to the Azure Function Endpoint. The EventGridTrigger is triggered only when changes occur within the selected event types.

    Blob Storage Event

    Hope this helps!

    If you found this answer helpful, please click Accept Answer and kindly upvote it.

    Accept Answer

    If you have any further questions, please click Comment.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.