Azure Function Destination

This destination is currently in beta. If you are interested in joining, let us know!

Segment makes it easy to send your data to Azure Function (and lots of other destinations). Once you’ve tracked your data through our open source libraries we’ll translate and route your data to Azure Function in the format they understand. Learn more about how to use Azure Function with Segment.

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.

NOTE: Azure Function is currently in beta, and this doc was last updated on May 6, 2019. This means that there may still be some bugs for us to iron out and we’re excited to hear your thoughts. If you are interested in joining or have any feedback to help us improve the Azure Function Destination and its documentation, please let us know!

Getting Started

The first step is to make sure Azure Function supports the source type and connection mode you’ve chosen to implement. You can learn more about what dictates the connection modes we support here.

WebMobileServer
📱 Device-mode
☁️ Cloud-mode

Build an Azure Function to Process Segment Events

In order to process events from Segment, you will need to provide a Azure Function that can handle your event flow:

  • Click on +Add to create your Function App.
  • In the App name field, name your app.
  • Configure the other fields with your own flavor.
  • Click on the Create button.
  • Once your function app is created, click on its name (you may have to refresh the list by clicking on the Refresh button.
  • On the left pane, click on the Functions button.
  • In the main frame, click on New function.
  • Click on HTTP trigger.
  • In the Name field, name your function.
  • In Authorization level field, chose Function.
  • Click on the Create button.
  • Setup your function code.
  • In the created function screen, click on </> Get function URL.
  • In the Key field, if not already selected, select default (Function key).
  • Click on the Copy button in order to copy the URL. Keep this URL in order to later setup the Azure Function Segment destination.

Configure Azure Function Destination

Once the Azure Function is created, a destination that will call the function must be configured:

  • In our Destinations section, click on Add Destination. You will be redirected to our Catalog.
  • Search and client on Azure Function destination.
  • Click on Configure Azure Function.
  • Fill the settings.

Settings:

| HTTP Trigger | The URL copied from </> Get function URL button in the Azure function code screen. |


Personas

You can send computed traits and audiences generated through Segment Personas to this destination as a user property. To learn more about Personas, reach out for a demo.

For user-property destinations, an identify call will be sent to the destination for each user being added and removed. The property name will be the snake_cased version of the audience name you provide with a true/false value. For example, when a user first completes an order in the last 30 days, we will send an identify call with the property order_completed_last_30days: true, and when this user no longer satisfies we will set that value to false.

When the audience is first created an identify call is sent for every user in the audience. Subsequent syncs will only send updates for those users which were added or removed since the last sync.

Settings

Segment lets you change these destination settings via your Segment dashboard without having to touch any code.

HTTP Trigger

The URL to call the Google Cloud Function. It must follow the https://{function app name}.azurewebsites.net/api/{function name}?code={function key} pattern.

Adding Azure Function to the integrations object

To add Azure Function to the integrations JSON object (for example, to filter data from a specific source), use one of the 1 valid names for this integration:
  • Azure Function


  • Questions? Need help? Contact us!
    Can we improve this doc?
    Email us: docs-feedback@segment.com!