![]() |
VOOZH | about |
dotnet add package Microsoft.Azure.WebJobs.Extensions.EventGrid --version 3.5.0
NuGet\Install-Package Microsoft.Azure.WebJobs.Extensions.EventGrid -Version 3.5.0
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.EventGrid" Version="3.5.0" />
<PackageVersion Include="Microsoft.Azure.WebJobs.Extensions.EventGrid" Version="3.5.0" />Directory.Packages.props
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.EventGrid" />Project file
paket add Microsoft.Azure.WebJobs.Extensions.EventGrid --version 3.5.0
#r "nuget: Microsoft.Azure.WebJobs.Extensions.EventGrid, 3.5.0"
#:package Microsoft.Azure.WebJobs.Extensions.EventGrid@3.5.0
#addin nuget:?package=Microsoft.Azure.WebJobs.Extensions.EventGrid&version=3.5.0Install as a Cake Addin
#tool nuget:?package=Microsoft.Azure.WebJobs.Extensions.EventGrid&version=3.5.0Install as a Cake Tool
This extension provides functionality for receiving Event Grid webhook calls in Azure Functions, allowing you to easily write functions that respond to any event published to Event Grid.
Install the Event Grid extension with NuGet:
dotnet add package Microsoft.Azure.WebJobs.Extensions.EventGrid
You must have an Azure subscription and an Azure resource group with a custom Event Grid topic or domain. Follow this step-by-step tutorial to register the Event Grid resource provider and create Event Grid topics using the Azure portal. There is a similar tutorial using Azure CLI.
In order for the extension publish events, you will need the endpoint of the Event Grid topic and a credential, which can be created using the topic's access key.
You can find the endpoint for your Event Grid topic either in the Azure Portal or by using the Azure CLI snippet below.
az eventgrid topic show --name <your-resource-name> --resource-group <your-resource-group-name> --query "endpoint"
The access key can also be found through the portal, or by using the Azure CLI snippet below:
az eventgrid topic key list --name <your-resource-name> --resource-group <your-resource-group-name> --query "key1"
Please follow the binding tutorial to learn about using this extension for publishing EventGrid events.
Please follow the tutorial to learn about triggering an Azure Function when an event is published.
If you are using the EventGrid schema for your topic, you can output EventGridEvents.
public static class EventGridEventBindingFunction
{
[FunctionName("EventGridEventBindingFunction")]
public static async Task<IActionResult> RunAsync(
[HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req,
[EventGrid(TopicEndpointUri = "EventGridEndpoint", TopicKeySetting = "EventGridKey")] IAsyncCollector<EventGridEvent> eventCollector)
{
EventGridEvent e = new EventGridEvent(await req.ReadAsStringAsync(), "IncomingRequest", "IncomingRequest", "1.0.0");
await eventCollector.AddAsync(e);
return new OkResult();
}
}
If you are using the CloudEvent schema for your topic, you can output CloudEvents.
public static class CloudEventBindingFunction
{
[FunctionName("CloudEventBindingFunction")]
public static async Task<IActionResult> RunAsync(
[HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req,
[EventGrid(TopicEndpointUri = "EventGridEndpoint", TopicKeySetting = "EventGridKey")] IAsyncCollector<CloudEvent> eventCollector)
{
CloudEvent e = new CloudEvent("IncomingRequest", "IncomingRequest", await req.ReadAsStringAsync());
await eventCollector.AddAsync(e);
return new OkResult();
}
}
It is also possible to use Azure Identity with the output binding. To do so, set the Connection property to the name of your app setting that contains your Event Grid Topic endpoint along with a set of optional Identity information that is described in detail here. When setting the Connection property, the TopicEndpointUri and TopicKeySetting properties should NOT be set.
public static class CloudEventOutputBindingWithIdentityFunction
{
[FunctionName("CloudEventOutputBindingWithIdentityFunction")]
public static async Task<IActionResult> RunAsync(
[HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req,
[EventGrid(Connection = "MyConnection")] IAsyncCollector<CloudEvent> eventCollector)
{
CloudEvent e = new CloudEvent("IncomingRequest", "IncomingRequest", await req.ReadAsStringAsync());
await eventCollector.AddAsync(e);
return new OkResult();
}
}
For local development, use the local.settings.json file to store the connection information:
{
"Values": {
"myConnection__topicEndpointUri": "{topicEndpointUri}"
}
}
When deployed, use the application settings to store this information.
You can also output a string or JObject and the extension will attempt to parse into the correct strongly typed event.
You can also create a function that will be executed whenever an event is delivered to your topic. Depending on the schema you have selected for your Azure Function event subscription, you can bind to either EventGridEvent or CloudEvent:
public static class EventGridEventTriggerFunction
{
[FunctionName("EventGridEventTriggerFunction")]
public static void Run(
ILogger logger,
[EventGridTrigger] EventGridEvent e)
{
logger.LogInformation("Event received {type} {subject}", e.EventType, e.Subject);
}
}
And if your subscription is configured with the CloudEvent schema:
public static class CloudEventTriggerFunction
{
[FunctionName("CloudEventTriggerFunction")]
public static void Run(
ILogger logger,
[EventGridTrigger] CloudEvent e)
{
logger.LogInformation("Event received {type} {subject}", e.Type, e.Subject);
}
}
It is also possible to bind to an array of events. This is useful if you have batching enabled for your Event Grid Subscription.
public static class EventGridEventBatchTriggerFunction
{
[FunctionName("EventGridEventBatchTriggerFunction")]
public static void Run(
ILogger logger,
[EventGridTrigger] EventGridEvent[] events)
{
foreach (EventGridEvent eventGridEvent in events)
{
logger.LogInformation("Event received {type} {subject}", eventGridEvent.EventType, eventGridEvent.Subject);
}
}
}
Similarly, for subscriptions configured with the CloudEvent schema:
public static class CloudEventBatchTriggerFunction
{
[FunctionName("CloudEventBatchTriggerFunction")]
public static void Run(
ILogger logger,
[EventGridTrigger] CloudEvent[] events)
{
foreach (CloudEvent cloudEvent in events)
{
logger.LogInformation("Event received {type} {subject}", cloudEvent.Type, cloudEvent.Subject);
}
}
}
Please refer to Monitor Azure Functions for troubleshooting guidance.
Read the introduction to Azure Function or creating an Azure Function guide.
See our CONTRIBUTING.md for details on building, testing, and contributing to this library.
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit cla.microsoft.com.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact with any additional questions or comments.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 2 NuGet packages that depend on Microsoft.Azure.WebJobs.Extensions.EventGrid:
| Package | Downloads |
|---|---|
|
Microsoft.Azure.Workflows.WebJobs.Extension
Extensions for running workflows in Azure Functions |
|
|
Reimaginate.DataHub.AzureFunctionAgentHost
Package Description |
Showing the top 5 popular GitHub repositories that depend on Microsoft.Azure.WebJobs.Extensions.EventGrid:
| Repository | Stars |
|---|---|
|
Azure-Samples/Serverless-microservices-reference-architecture
This reference architecture walks you through the decision-making process involved in designing, developing, and delivering a serverless application using a microservices architecture through hands-on instructions for configuring and deploying all of the architecture's components along the way. The goal is to provide practical hands-on experience in working with several Azure services and the technologies that effectively use them in a cohesive and unified way to build a serverless-based microservices architecture.
|
|
|
microsoft/IgniteTheTour
Microsoft Ignite The Tour
|
|
|
Azure-Samples/azure-digital-twins-unreal-integration
Sample project demonstrating the Unreal Engine plug-in for Azure Digital Twins
|
|
|
MerrionComputing/EventsSourcing-on-Azure-Functions
A library to demonstrate doing Event Sourcing as a data persistence mechanism for Azure Functions
|
|
|
microsoft/ignite-learning-paths-training-mod
Microsoft Ignite Learning Path, Train the Trainer materials: Modernizing Web Applications and Data
|
| Version | Downloads | Last Updated |
|---|---|---|
| 3.5.0 | 621,563 | 6/20/2025 |
| 3.4.4 | 469,107 | 3/14/2025 |
| 3.4.3 | 254,861 | 11/19/2024 |
| 3.4.2 | 1,454,214 | 7/31/2024 |
| 3.4.1 | 272,953 | 4/17/2024 |
| 3.3.1 | 1,422,084 | 11/13/2023 |
| 3.3.0 | 798,341 | 6/15/2023 |
| 3.2.1 | 1,602,673 | 9/8/2022 |
| 3.2.0 | 1,477,640 | 4/21/2022 |
| 3.1.0 | 596,162 | 1/13/2022 |
| 3.0.1 | 159,130 | 12/14/2021 |
| 3.0.0 | 177,056 | 10/26/2021 |
| 3.0.0-beta.4 | 14,563 | 10/11/2021 |
| 3.0.0-beta.3 | 338,056 | 6/9/2021 |
| 3.0.0-beta.2 | 18,918 | 5/13/2021 |
| 3.0.0-beta.1 | 21,763 | 3/23/2021 |
| 2.1.0 | 3,959,588 | 10/19/2019 |
| 2.0.0 | 783,974 | 9/19/2018 |
| 2.0.0-rc1 | 2,006 | 9/14/2018 |
| 2.0.0-beta4 | 6,398 | 8/30/2018 |