|
| 1 | +--- |
| 2 | +title: How to send events from Auth0 to Azure using Azure Event Grid |
| 3 | +description: How to end events from Auth0 to Azure services with Azure Event Grid. |
| 4 | +services: event-grid |
| 5 | +author: banisadr |
| 6 | + |
| 7 | +ms.service: event-grid |
| 8 | +ms.topic: conceptual |
| 9 | +ms.date: 05/18/2020 |
| 10 | +ms.author: babanisa |
| 11 | +--- |
| 12 | + |
| 13 | +# Integrate Azure Event Grid with Auth0 |
| 14 | + |
| 15 | +This article describes how to connect your Auth0 and Azure accounts by creating an Event Grid partner topic. |
| 16 | + |
| 17 | +See the [Auth0 event type codes](https://auth0.com/docs/logs/references/log-event-type-codes) for a full list of the events that Auth0 supports |
| 18 | + |
| 19 | +## Send events from Auth0 to Azure Event Grid |
| 20 | +To send Auth0 events to Azure: |
| 21 | + |
| 22 | +1. Enable Event Grid resource provider |
| 23 | +1. Set up an Auth0 Partner Topic in the Auth0 Dashboard |
| 24 | +1. Activate the Partner Topic in Azure |
| 25 | +1. Subscribe to events from Auth0 |
| 26 | + |
| 27 | +For more information about these concepts, see Event Grid [concepts](concepts.md). |
| 28 | + |
| 29 | +### Enable Event Grid resource provider |
| 30 | +Unless you've used Event Grid before, you'll need to register the Event Grid resource provider. If you’ve used Event Grid before, skip to the next section. |
| 31 | + |
| 32 | +In the Azure portal: |
| 33 | +1. Select Subscriptions on the left menu |
| 34 | +1. Select the subscription you’re using for Event Grid |
| 35 | +1. On the left menu, under Settings, select Resource providers |
| 36 | +1. Find Microsoft.EventGrid |
| 37 | +1. Select Register |
| 38 | +1. Refresh to make sure the status changes to Registered |
| 39 | + |
| 40 | +### Set up an Auth0 Partner Topic |
| 41 | +Part of the integration process is to set up Auth0 for use as an event source (this step happens in your [Auth0 Dashboard](https://manage.auth0.com/)). |
| 42 | + |
| 43 | +1. Log in to the [Auth0 Dashboard](https://manage.auth0.com/). |
| 44 | +1. Navigate to Logs > Streams. |
| 45 | +1. Click + Create Stream. |
| 46 | +1. Select Azure Event Grid and enter a unique name for your new stream. |
| 47 | +1. Create the event source by providing your Azure Subscription ID, Azure Region, and a Resource Group name. |
| 48 | +1. Click Save. |
| 49 | + |
| 50 | +### Activate your Auth0 Partner Topic in Azure |
| 51 | +Activating the Auth0 topic in Azure allows events to flow from Auth0 to Azure. |
| 52 | + |
| 53 | +1. Log in to the Azure portal. |
| 54 | +1. Search `Partner Topics` at the top and click `Event Grid Partner Topics` under services. |
| 55 | +1. Click on the topic that matches the stream you created in your Auth0 Dashboard. |
| 56 | +1. Confirm the `Source` field matches your Auth0 account. |
| 57 | +1. Click Activate. |
| 58 | + |
| 59 | +### Subscribe to Auth0 events |
| 60 | + |
| 61 | +#### Create an event handler |
| 62 | +To test your Partner Topic, you'll need an event handler. Go to your Azure subscription and spin up a service that is supported as an [event handler](event-handlers.md) such as an [Azure Function](custom-event-to-function.md). |
| 63 | + |
| 64 | +#### Subscribe to your Auth0 Partner Topic |
| 65 | +Subscribing to your Auth0 Partner Topic allows you to tell Event Grid where you want your Auth0 events to go. |
| 66 | + |
| 67 | +1. On the Partner Topic blade for your Auth0 integration, select + Event Subscription at the top. |
| 68 | +1. On the Create Event Subscription page: |
| 69 | + 1. Enter a name for the event subscription. |
| 70 | + 1. Select the Azure service or WebHook you created for the Endpoint type. |
| 71 | + 1. Follow the instructions for the particular service. |
| 72 | + 1. Click Create. |
| 73 | + |
| 74 | +## Testing |
| 75 | +Your Auth0 Partner Topic integration with Azure should be ready to use. |
| 76 | + |
| 77 | +### Verify the integration |
| 78 | +To verify that the integration is working as expected: |
| 79 | + |
| 80 | +1. Log in to the Auth0 Dashboard. |
| 81 | +1. Navigate to Logs > Streams. |
| 82 | +1. Click on your Event Grid stream. |
| 83 | +1. Once on the stream, click on the Health tab. The stream should be active and as long as you don't see any errors, the stream is working. |
| 84 | + |
| 85 | +Try [invoking any of the Auth0 actions that trigger an event to be published](https://auth0.com/docs/logs/references/log-event-type-codes) to see events flow. |
| 86 | + |
| 87 | +## Delivery attempts and retries |
| 88 | +Auth0 events are delivered to Azure via a streaming mechanism. Each event is sent as it is triggered in Auth0. If Event Grid is unable to receive the event, Auth0 will retry up to three times to deliver the event. Otherwise, Auth0 will log the failure to deliver in its system. |
| 89 | + |
| 90 | +## Next steps |
| 91 | + |
| 92 | +- [Auth0 Partner Topic](auth0-overview.md) |
| 93 | +- [Partner topics overview](partner-topics-overview.md) |
| 94 | +- [Become an Event Grid partner](partner-onboarding-overview.md) |
0 commit comments