diff --git a/eng/Packages.Data.props b/eng/Packages.Data.props
index a02b517672e6..cfde2e6133de 100644
--- a/eng/Packages.Data.props
+++ b/eng/Packages.Data.props
@@ -163,6 +163,8 @@
+
+
diff --git a/sdk/eventgrid/Microsoft.Azure.WebJobs.Extensions.EventGrid/CHANGELOG.md b/sdk/eventgrid/Microsoft.Azure.WebJobs.Extensions.EventGrid/CHANGELOG.md
index 02434784717d..2eed568455ef 100644
--- a/sdk/eventgrid/Microsoft.Azure.WebJobs.Extensions.EventGrid/CHANGELOG.md
+++ b/sdk/eventgrid/Microsoft.Azure.WebJobs.Extensions.EventGrid/CHANGELOG.md
@@ -1,3 +1,5 @@
# Release History
## 3.0.0-beta.1 (Unreleased)
+
+- The initial release of Microsoft.Azure.WebJobs.Extensions.EventGrid 3.0.0
diff --git a/sdk/eventgrid/Microsoft.Azure.WebJobs.Extensions.EventGrid/README.md b/sdk/eventgrid/Microsoft.Azure.WebJobs.Extensions.EventGrid/README.md
index 16ebfef5635c..1c81bf7deb71 100644
--- a/sdk/eventgrid/Microsoft.Azure.WebJobs.Extensions.EventGrid/README.md
+++ b/sdk/eventgrid/Microsoft.Azure.WebJobs.Extensions.EventGrid/README.md
@@ -1,34 +1,113 @@
# Azure WebJobs EventGrid client library for .NET
-TODO
+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.
## Getting started
### Install the package
+Install the Event Grid extension with [NuGet][nuget]:
+
+```Powershell
+dotnet add package Microsoft.Azure.WebJobs.Extensions.EventGrid
+```
### Prerequisites
+You must have an [Azure subscription](https://azure.microsoft.com/free/) and an Azure resource group with a custom Event Grid topic or domain. Follow this [step-by-step tutorial](https://docs.microsoft.com/azure/event-grid/custom-event-quickstart-portal) to register the Event Grid resource provider and create Event Grid topics using the [Azure portal](https://portal.azure.com/). There is a [similar tutorial](https://docs.microsoft.com/azure/event-grid/custom-event-quickstart) using [Azure CLI](https://docs.microsoft.com/cli/azure).
+
+### Authenticate the Client
+
+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.
-### Authenticate the client
+You can find the endpoint for your Event Grid topic either in the [Azure Portal](https://portal.azure.com/) or by using the [Azure CLI](https://docs.microsoft.com/cli/azure) snippet below.
+```bash
+az eventgrid topic show --name --resource-group --query "endpoint"
+```
+
+The access key can also be found through the [portal](https://docs.microsoft.com/azure/event-grid/get-access-keys), or by using the Azure CLI snippet below:
+```bash
+az eventgrid topic key list --name --resource-group --query "key1"
+```
## Key concepts
-TODO
+### Using Event Grid output binding
+
+Please follow the [binding tutorial](https://docs.microsoft.com/azure/azure-functions/functions-bindings-event-grid-trigger?tabs) to learn about using this extension for publishing EventGrid events.
+
+### Using Event Grid trigger
+
+Please follow the [tutorial](https://docs.microsoft.com/azure/azure-functions/functions-bindings-event-grid-trigger?tabs=csharp) to learn about triggering an Azure Function when an event is published.
## Examples
-TODO
+### Functions that uses Event Grid binding
+
+```C# Snippet:EventGridBindingFunction
+public static class EventGridBindingFunction
+{
+ [FunctionName("EventGridBindingFunction")]
+ public static async Task RunAsync(
+ [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req,
+ [EventGrid(TopicEndpointUri = "EventGridEndpoint", TopicKeySetting = "EventGridKey")] IAsyncCollector eventCollector)
+ {
+ EventGridEvent e = new EventGridEvent(await req.ReadAsStringAsync(), "IncomingRequest", "IncomingRequest", "1.0.0");
+ await eventCollector.AddAsync(e);
+ return new OkResult();
+ }
+}
+```
+
+### Functions that uses Event Grid trigger
+
+```C# Snippet:EventGridTriggerFunction
+public static class EventGridTriggerFunction
+{
+ [FunctionName("EventGridTriggerFunction")]
+ public static void Run(
+ ILogger logger,
+ [EventGridTrigger] EventGridEvent e)
+ {
+ logger.LogInformation("Event received {type} {subject}", e.EventType, e.Subject);
+ }
+}
+```
## Troubleshooting
-TODO
+Please refer to [Monitor Azure Functions](https://docs.microsoft.com/azure/azure-functions/functions-monitoring) for troubleshooting guidance.
## Next steps
-TODO
+Read the [introduction to Azure Function](https://docs.microsoft.com/azure/azure-functions/functions-overview) or [creating an Azure Function guide](https://docs.microsoft.com/azure/azure-functions/functions-create-first-azure-function).
## Contributing
-TODO
\ No newline at end of file
+See our [CONTRIBUTING.md][contrib] 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][cla].
+
+This project has adopted the [Microsoft Open Source Code of Conduct][coc].
+For more information see the [Code of Conduct FAQ][coc_faq]
+or contact [opencode@microsoft.com][coc_contact] with any
+additional questions or comments.
+
+
+
+
+[source]: https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/search/Microsoft.Azure.WebJobs.Extensions.EventGrid/src
+[package]: https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.EventGrid/
+[docs]: https://docs.microsoft.com/dotnet/api/Microsoft.Azure.WebJobs.Extensions.EventGrid
+[nuget]: https://www.nuget.org/
+
+[contrib]: https://github.com/Azure/azure-sdk-for-net/tree/master/CONTRIBUTING.md
+[cla]: https://cla.microsoft.com
+[coc]: https://opensource.microsoft.com/codeofconduct/
+[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/
+[coc_contact]: mailto:opencode@microsoft.com
diff --git a/sdk/eventgrid/Microsoft.Azure.WebJobs.Extensions.EventGrid/src/EventGridExtensionConfigProvider.cs b/sdk/eventgrid/Microsoft.Azure.WebJobs.Extensions.EventGrid/src/EventGridExtensionConfigProvider.cs
index 844e9a99e5e6..814fc4d50ccd 100644
--- a/sdk/eventgrid/Microsoft.Azure.WebJobs.Extensions.EventGrid/src/EventGridExtensionConfigProvider.cs
+++ b/sdk/eventgrid/Microsoft.Azure.WebJobs.Extensions.EventGrid/src/EventGridExtensionConfigProvider.cs
@@ -9,6 +9,7 @@
using System.Threading;
using System.Threading.Tasks;
using System.Web;
+using Azure;
using Azure.Messaging.EventGrid;
using Microsoft.Azure.WebJobs.Description;
using Microsoft.Azure.WebJobs.Host.Bindings;
@@ -42,7 +43,7 @@ internal EventGridExtensionConfigProvider(Func new EventGridAsyncCollector(new EventGridPublisherClient(new Uri(attr.TopicEndpointUri), new EventGridSharedAccessSignatureCredential(attr.TopicKeySetting))));
+ _converter = (attr => new EventGridAsyncCollector(new EventGridPublisherClient(new Uri(attr.TopicEndpointUri), new AzureKeyCredential(attr.TopicKeySetting))));
_loggerFactory = loggerFactory;
}
diff --git a/sdk/eventgrid/Microsoft.Azure.WebJobs.Extensions.EventGrid/tests/Microsoft.Azure.WebJobs.Extensions.EventGrid.Tests.csproj b/sdk/eventgrid/Microsoft.Azure.WebJobs.Extensions.EventGrid/tests/Microsoft.Azure.WebJobs.Extensions.EventGrid.Tests.csproj
index a96422f497f8..dbac362a9cb3 100644
--- a/sdk/eventgrid/Microsoft.Azure.WebJobs.Extensions.EventGrid/tests/Microsoft.Azure.WebJobs.Extensions.EventGrid.Tests.csproj
+++ b/sdk/eventgrid/Microsoft.Azure.WebJobs.Extensions.EventGrid/tests/Microsoft.Azure.WebJobs.Extensions.EventGrid.Tests.csproj
@@ -10,6 +10,7 @@
+
diff --git a/sdk/eventgrid/Microsoft.Azure.WebJobs.Extensions.EventGrid/tests/Samples/EventGridBindingFunction.cs b/sdk/eventgrid/Microsoft.Azure.WebJobs.Extensions.EventGrid/tests/Samples/EventGridBindingFunction.cs
new file mode 100644
index 000000000000..db9bf51a6f3b
--- /dev/null
+++ b/sdk/eventgrid/Microsoft.Azure.WebJobs.Extensions.EventGrid/tests/Samples/EventGridBindingFunction.cs
@@ -0,0 +1,28 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+using System.Threading.Tasks;
+using Azure.Messaging.EventGrid;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Azure.WebJobs;
+using Microsoft.Azure.WebJobs.Extensions.Http;
+using Microsoft.Azure.WebJobs.Extensions.EventGrid;
+
+namespace Azure.Extensions.WebJobs.Sample
+{
+ #region Snippet:EventGridBindingFunction
+ public static class EventGridBindingFunction
+ {
+ [FunctionName("EventGridBindingFunction")]
+ public static async Task RunAsync(
+ [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req,
+ [EventGrid(TopicEndpointUri = "EventGridEndpoint", TopicKeySetting = "EventGridKey")] IAsyncCollector eventCollector)
+ {
+ EventGridEvent e = new EventGridEvent(await req.ReadAsStringAsync(), "IncomingRequest", "IncomingRequest", "1.0.0");
+ await eventCollector.AddAsync(e);
+ return new OkResult();
+ }
+ }
+ #endregion
+}
\ No newline at end of file
diff --git a/sdk/eventgrid/Microsoft.Azure.WebJobs.Extensions.EventGrid/tests/Samples/EventGridTriggerFunction.cs b/sdk/eventgrid/Microsoft.Azure.WebJobs.Extensions.EventGrid/tests/Samples/EventGridTriggerFunction.cs
new file mode 100644
index 000000000000..2a36bfefd203
--- /dev/null
+++ b/sdk/eventgrid/Microsoft.Azure.WebJobs.Extensions.EventGrid/tests/Samples/EventGridTriggerFunction.cs
@@ -0,0 +1,23 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+using Microsoft.Azure.WebJobs;
+using Microsoft.Azure.WebJobs.Extensions.EventGrid;
+using Azure.Messaging.EventGrid;
+using Microsoft.Extensions.Logging;
+
+namespace Azure.Extensions.WebJobs.Sample
+{
+ #region Snippet:EventGridTriggerFunction
+ public static class EventGridTriggerFunction
+ {
+ [FunctionName("EventGridTriggerFunction")]
+ public static void Run(
+ ILogger logger,
+ [EventGridTrigger] EventGridEvent e)
+ {
+ logger.LogInformation("Event received {type} {subject}", e.EventType, e.Subject);
+ }
+ }
+ #endregion
+}