Route Events to Azure Function - Azure Event Grid
    • Dark
      Light
    • PDF

    Route Events to Azure Function - Azure Event Grid

    • Dark
      Light
    • PDF

    Article Summary

    With Event Grid as a kind of Event Broker, any application can push events to an Event Topic, and any or multiple subscribers can have events pushed to them. One of the event subscribers can be an Azure Function, a capability in Azure to run the code. In contrast to having a Logic App as a handler (low-code), an Azure Function means creating code to handle an event.

    A classic example with Event Grid is when a blob is created in a container resulting in a blobCreated event.

    Through the events in the storage account blade, you can create an Azure Function handling this event.

    Route events to an Azure Function.png

    For example, when you click create on “Trigger Azure Functions” you will see a new pane appear, where you must select your Function App. Next, create a function (you can choose through an IDE like VSCode or Visual Studio) or using the portal. Either way, you will need to select a template for Azure Event Grid trigger.

    With the Azure Event Grid trigger template, you can add code to handle the event. Next, you add a subscription to the Event Grid of the source, in our case the Storage Account. You will need to provide a name for the subscription, select the event topic type, specify the event type, and click create.
    Azure Event Grid Tips – Route events to an Azure.png

    Now you have created a webhook to the function and can handle the blobCreated events in a Function.

    Event-grid-1.png


    Was this article helpful?