Azure Function Destination

Destination Info
Components
  • Server
Connection Modes
Device-mode Cloud-mode
Web Web
Mobile Mobile
Server Server

Segment makes it easy to send your data to Azure Function (and lots of other destinations). When you track your data using Segment’s open-source libraries, Segment can translate and route your data to an Azure Function in the format it expects.

Azure Function is a serverless compute service that enables you to run code on-demand without having to explicitly provision or manage infrastructure. Use Azure Functions to run a script or piece of code in response to a variety of events.

This document is about a destination which is in beta

This means that the Azure Function Destination is in active development, and some functionality may change before it becomes generally available.

Getting Started

Build an Azure Function to Process Segment Events

To process events from Segment, first create a Azure Function that can handle your event flow.

Create a Functions App

  1. Go to https://portal.azure.com, and click Functions App. A screenshot of the Azure services dashboard.

  2. Click +Add to create your Function App. A screenshot of the Function Apps dashboard.

  3. Enter a name for your app in the App name field, and configure any other fields as needed own flavor.
  4. Click Create. Azure creates your new function app. A screenshot of the Function App settings page.

Create a new Azure function

  1. Click the new function app’s name. (You might need to click the Refresh button if the new function doesn’t appear.) A screenshot of the Function App dashboard.

  2. On the left pane, click Functions. A screenshot of the function dashboard.

  3. In the main frame, click New function. A screenshot of the function panel.

  4. Choose HTTP trigger. A screenshot of the new function setup page.

  5. Enter a name for your function, and choose Function for the Authorization level field. A screenshot of the HTTP trigger setup panel, with a name entered in the Name field and Function chosen as the Authorization level.
  6. Click Create.

  7. Set up your function code.
  8. In the created function screen, click on </> Get function URL. A screenshot of the function panel.

  9. In the Key field, choose default (Function key).
  10. Click Copy to the right of the URL. You’ll use this URL to tell Segment where to connect to use this Azure Function. A screenshot of the Get function URL popup.

Configure Azure Function Destination

After you create the Azure Function, configure a Segment destination that calls the function.

  1. In the Segment web app, click Destinations.
  2. Click Add Destination to go to the Catalog.
  3. Search for and choose the Azure Function destination.
  4. Click Configure Azure Function.
  5. In the HTTP Trigger field, enter the URL you copied from the </> Get function URL button in the Azure function code screen.

Engage

You can send computed traits and audiences generated using Engage to this destination as a user property. To learn more about Engage, schedule a demo.

For user-property destinations, an identify call is sent to the destination for each user being added and removed. The property name is the snake_cased version of the audience name, with a true/false value to indicate membership. For example, when a user first completes an order in the last 30 days, Engage sends an Identify call with the property order_completed_last_30days: true. When the user no longer satisfies this condition (for example, it’s been more than 30 days since their last order), Engage sets that value to false.

When you first create an audience, Engage sends an Identify call for every user in that audience. Later audience syncs only send updates for users whose membership has changed since the last sync.

Real-time to batch destination sync frequency

Real-time audience syncs to Azure Function may take six or more hours for the initial sync to complete. Upon completion, a sync frequency of two to three hours is expected.

Settings

Segment lets you change these destination settings from the Segment app without having to touch any code.

Setting Description
HTTP Trigger
(required)
string. The URL to call the Function. It must follow the ` https://{function app name}.azurewebsites.net/api/{function name}?code={function key}` pattern.

This page was last modified: 07 Aug 2024



Get started with Segment

Segment is the easiest way to integrate your websites & mobile apps data to over 300 analytics and growth tools.
or
Create free account