Monitor, receive, and send events with the Event Hubs connector

To set up an event monitor so that your logic app can detect events, receive events, and send events, connect to an Azure Event Hub from your logic app. Learn more about Azure Event Hubs and how pricing works for Logic Apps connectors.

Prerequisites

Before you can use the Event Hubs connector, you must have these items:

Connect to Azure Event Hubs

Before your logic app can access any service, you have to create a connection between your logic app and the service, if you haven't already. This connection authorizes your logic app to access data. For your logic app to access your Event Hub, check your permissions and get the connection string for your Event Hubs namespace.

  1. Sign in to the Azure portal.

  2. Go to your Event Hubs namespace, not a specific Event Hub. On the namespace page, under Settings, choose Shared access policies. Under Claims, check that you have Manage permissions for that namespace.

    Manage permissions for your Event Hub namespace

  3. If you want to later manually enter your connection information, get the connection string for your Event Hubs namespace. Choose RootManageSharedAccessKey. Next to your primary key connection string, choose the copy button. Save the connection string for later use.

    Copy Event Hubs namespace connection string

    Tip

    To confirm whether your connection string is associated with your Event Hubs namespace or with a specific event hub, check the connection string for the EntityPath parameter. If you find this parameter, the connection string is for a specific Event Hub "entity", and is not the correct string to use with your logic app.

Trigger workflow when your Event Hub gets new events

A trigger is an event that starts a workflow in your logic app. To start a workflow when new events are sent to your Event Hub, follow these steps for adding the trigger that detects this event.

  1. In the Azure portal, go to your existing logic app or create a blank logic app.

  2. In Logic Apps Designer, enter "event hubs" in the search box as your filter. Select this trigger: When events are available in Event Hub

    Select trigger for when your Event Hub receives new events

    1. If you don't already have a connection to your Event Hubs namespace, you're prompted to create this connection now. Give your connection a name, and select the Event Hubs namespace that you want to use.

      Create Event Hub connection

      Or, to manually enter the connection string, choose Manually enter connection information. Learn how to find your connection string.

    2. Now select the Event Hubs policy to use, and choose Create.

      Create Event Hub connection, part 2

  3. Select the Event Hub to monitor, and set up the interval and frequency for when to check the Event Hub.

    Specify Event Hub or consumer group

    Tip

    To optionally select a consumer group for reading events, choose Show advanced options.

  4. Save your logic app. On the designer toolbar, choose Save.

Now, when your logic app checks the selected Event Hub and finds a new event, the trigger runs the actions in your logic app for the found event.

Send events to your Event Hub from your logic app

An action is a task performed by your logic app workflow. After you add a trigger to your logic app, you can add an action to perform operations with data generated by that trigger. To send an event to your Event Hub from your logic app, follow these steps.

  1. In Logic Apps Designer, under your trigger, choose New step > Add an action.

  2. In the search box, enter "event hubs" as your filter. Select this action: Event Hubs - Send event

    Select "Event Hubs - Send event"

  3. Select the Event Hub for where to send the event. Then, enter the event content and any other details.

    Select Event Hub name and provide event content

  4. Save your logic app.

You've now set up an action that sends events from your logic app.

Connector-specific details

To learn more about triggers and actions defined by the Swagger file and any limits, review the connector details.

Get support

Next steps