# Azure Function Destination

## Destination Info

* Accepts [Page](/docs/segment/connections/spec/page), [Alias](/docs/segment/connections/spec/alias), [Group](/docs/segment/connections/spec/group), [Identify](/docs/segment/connections/spec/identify), [Track](/docs/segment/connections/spec/track) calls.
* Refer to it as **Azure Function** in the [Integrations object.](/docs/segment/guides/filtering-data/#filtering-with-the-integrations-object)
* This destination is **Beta.**

### Components

* Server

## Connection Modes

[Learn more about connection modes.](/docs/segment/connections/destinations/#connection-modes)

### Device-Mode

* web: no
* mobile: no
* server: no

### Cloud-Mode

* web: yes
* mobile: yes
* server: yes

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](/docs/segment/connections/sources/catalog/), Segment can translate and route your data to an Azure Function in the format it expects.

[Azure Function](https://azure.microsoft.com/en-us/services/functions) 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.

> \[!IMPORTANT]
>
> This means the feature is actively being developed, 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](https://portal.azure.com), and click **Functions App**.

   ![Azure dashboard highlighting Function App with recent resources listed.](https://docs-resources.prod.twilio.com/53e32072c46964ced8ae44e381b00d9d27b67f16e68a2b9bd707f5e91a75f68c.png)
2. Click **+Add** to create your Function App.

   ![Azure Function Apps dashboard showing two running apps with an Add button highlighted.](https://docs-resources.prod.twilio.com/edd1eda70dd8bf840a2d3fe3b80aadd34a5546fb4ffcf31d2f9caa5e08de802a.png)
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.

   ![Azure portal showing Get function URL popup with Copy button highlighted.](https://docs-resources.prod.twilio.com/7fca8c6d7d6a7e57de3100cdf3b2d6eafe039d9e02e1869cf0a45b70ecb1b93d.png)

##### 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.](https://docs-resources.prod.twilio.com/f96c4efefbd227c2c4557f6633f03c5be0264cf4cf7907ae50551cea0ca4eef8.png)
2. On the left pane, click **Functions**.

   ![A screenshot of the function dashboard.](https://docs-resources.prod.twilio.com/3db22ade9bc48779a3ab2a2378339cf5c83077c7dd4ee8b0a73afb5a5ba8b790.png)
3. In the main frame, click **New function**.

   ![A screenshot of the function panel. .](https://docs-resources.prod.twilio.com/fa3a595b4985c504e67d3d07ed55d6588b26cf0379a588afb34120e1a815119b.png)
4. Choose **HTTP trigger**.

   ![A screenshot of the new function setup page.](https://docs-resources.prod.twilio.com/365fe681238c0f410024554ea0757155fde55ceb2a25170c4e783aa4a30bffd4.png)
5. Enter a name for your function, and choose `Function` for the **Authorization level** field.

   ![HTTP trigger setup with 'my-function' as name and 'Function' as authorization level, highlighting 'Create' button.](https://docs-resources.prod.twilio.com/9afba5738743504f3a23a918a914a1c4033aafccd86a5c43bbc04b3dc8aa9cc9.png)
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.](https://docs-resources.prod.twilio.com/4d7fe1100ea6d8dcb30cfb1ab45bf310921177aacfe65e624076063f46182576.png)
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.](https://docs-resources.prod.twilio.com/f687445e1d19ffaa92b95067ea421cee995d68b746651214d4cccb26f6bf2052.png)

### 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](/docs/segment/engage) to this destination as a **user property**. To learn more about Engage, schedule a [demo](https://segment.com/contact/demo).

For user-property destinations, an [identify](/docs/segment/connections/spec/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.

> \[!NOTE]
>
> 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.

| Field        | Description                                                                                                                                             | Required | Type   |
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------ |
| HTTP Trigger | The URL to call the Function. It must follow the \` https://\{function app name}.azurewebsites.net/api/\{function name}?code=\{function key}\` pattern. | Yes      | string |
