This tutorial leverages the power of Auth0 Log Events to create a responsive sales pipeline using Azure Event Grid.

Identity management is so much more than simply lock and key. While login events are the doorway into your product, sign-up events are the first opportunity to welcome your customers to their new home. Auth0 Log Streaming provides near real-time access to these events, providing you with the ability to respond instantly the moment they step foot through your door.

With Event Grid, Azure takes us one step further and provides us with a virtual valet — helping us to build event-driven applications, and routing our events to powerful, cloud-based services.

What is Azure Event Grid?

Azure Event Grid is a highly-available event router that collects data from multiple sources and delivers them to Azure services. Whether it is streaming stock quotes via Service Bus and broadcasting to your users via WebSockets, or integrating your Auth0 identity data and kicking off serverless flows using Azure Functions, Event Grid is there to make it easy to develop serverless workflows, system automation, and distributed applications.

One of the cool ways to leverage this integration is to automate intake tasks into your CRM. Instead of requiring your sales team to dig through email lists and enter in new leads, we can generate them and notify our teams within moments of their arrival.

In this tutorial, we will see just how easily we can leverage the power of this new integration by using Auth0 Log Events to build a CRM pipeline.

What are we Building?

CRM professionals will tell you that organic growth is far more likely to lead to a sale than outreach. Now with Azure and Auth0, you can feed every new sign-up directly into your CRM with minimal latency between customer action and engagement, generating new leads just as fast as they arrive.

In this tutorial, you will be building an automatic Sales Leads pipeline using Microsoft’s CRM solution, Dynamics 365, in order to build a sales prospect pipeline.Every time a new user signs up for your service through Auth0’s user flow, a corresponding new potential sales lead will be populated in Dynamics 365.

Requirements:

Let’s get started!

Step 1: Set up an Auth0 Event Source

In order to complete this step, you should know:

  • Your Microsoft Azure Subscription ID
  • Your relevant Azure Resource Group
  • The Azure region in which you will create your Partner Topic

Part of the integration process is to set Auth0 as an Azure event source. Here's how you do that:

  • Log in to the Auth0 Dashboard.
  • Navigate to "Logs" > "Streams.
  • Click "+ Create Stream".
  • Select Azure Event Grid and enter a unique name for your new stream.
  • Create the event source by providing your Azure Subscription ID, Azure Region, and a Resource Group name.
  • Click Save.

Step 2. Activate your Auth0 Partner Topic in Azure

Activating the Auth0 topic in Azure allows events to flow from Auth0 to Azure.

  • After clicking "Save", click the link underneath your newly created Partner Topic in the Auth0 portal.
  • You will now be redirected to your Partner Topic in the Azure Portal.
  • Confirm the Partner Topic field matches your Auth0 account.
  • Click "Activate".

Step 3. Sign Up for a Dynamics 365: Sales Account

Step 4. Create a Logic App

  • Search Logic Apps in the search bar in Azure.
  • Create the app using your subscription, resource group, and desired region.
  • Go to resource once deployment completes.

Azure logic application designer

  • In "Logic App Designer", under "Start with a common trigger", click "When a Http Request is Received".

Azure logic application designer common trigger

In the popup, add the sample schema of an Auth0 log. Alternatively, you can paste a sample payload to generate a schema following the link underneath the sample schema prompt:

{
  "type": "object",
  "properties": {
    "specversion": {
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "source": {
      "type": "string"
    },
    "type": {
      "type": "string"
    },
    "datacontenttype": {
      "type": "string"
    },
    "data": {
      "type": "object",
      "properties": {
        "date": {
          "type": "string"
        },
        "type": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "connection": {
          "type": "string"
        },
        "connection_id": {
          "type": "string"
        },
        "client_id": {
          "type": "string"
        },
        "client_name": {
          "type": "string"
        },
        "ip": {
          "type": "string"
        },
        "user_agent": {
          "type": "string"
        },
        "details": {
          "type": "object",
          "properties": {
            "body": {
              "type": "object",
              "properties": {
                "tenant": {
                  "type": "string"
                },
                "client_id": {
                  "type": "string"
                },
                "connection": {
                  "type": "string"
                },
                "email": {
                  "type": "string"
                },
                "password": {
                  "type": "string"
                },
                "request_language": {
                  "type": "string"
                }
              }
            },
            "device_id": {
              "type": "string"
            }
          }
        },
        "user_id": {
          "type": "string"
        },
        "user_name": {
          "type": "string"
        },
        "strategy": {
          "type": "string"
        },
        "strategy_type": {
          "type": "string"
        },
        "log_id": {
          "type": "string"
        }
      }
    }
  }
}

Your Logic App will generate a URL upon save. Please copy this for later. Click "Run".

Azure logic designer app URL

Next, you'll connect to Dynamics 365.

Step 5. Connect to 365

First, click on "+ New step". Select Dynamics 365. If "Dynamics 365" does not appear, search for it in the search bar.

Azure logic designer Dynamics 365

  • Click "Actions: Create a New Record".
  • Sign in to 365 as asked.
  • Populate the Org name.
  • Entity Name: Leads (for sales leads).
  • Populate the fields as desired (with dynamic fields popup).
  • Save and then click "Run".

Next, let's create the new event subscription.

Step 6. Create Event Subscription

  • Create new event subscription.
  • In Event Schema, select "Cloud Event Schema v1.0".
  • For Topic Types, select "Event Grid Topics"
  • Populate the Subscription and Resource Group.
  • Under "Endpoint Details":
    • Select "Web Hook" as "Endpoint Type".
    • Then paste the endpoint.

Azure create subscription

  • Next, click the "Filters" tab:
    • For Advanced Filters, user the following:
      • Key: data.type
      • Operator: string is in
      • “ss”
    • Click "Create".

Step 7. Generate a Sign up Log and View Your New Sales Leads

Congratulations! In seven simple steps, you have now created an automated sales pipeline!

Azure new sales lead

Learn more

Using Azure Event Grid with Auth0 amplifies the possibilities for customization and protection of the end-user experience. Learn how to set up the Azure Event Grid Log Streams integration here, or sign up for a free Auth0 trial.

About Auth0

Auth0 provides a platform to authenticate, authorize, and secure access for applications, devices, and users. Security and application teams rely on Auth0's simplicity, extensibility, and expertise to make identity work for everyone. Safeguarding more than 4.5 billion login transactions each month, Auth0 secures identities so innovators can innovate, and empowers global enterprises to deliver trusted, superior digital experiences to their customers around the world.

For more information, visit https://auth0.com or follow @auth0 on Twitter.