Sending data to Azure Event Hubs

This documentation references external sources.

Nexthink does not control the accuracy of third-party documentation or external updates that can result in inconsistencies.

Report any errors or inconsistencies to Nexthink Support.

This document outlines how to send data to Azure Event Hubs using Nexthink Webhooks.

Prerequisites

Before you start, ensure you have the following:

  • Azure account

  • Postman account

  • Nexthink license

In Azure portal

Create a resource group

A resource group is a logical container for Azure resources.

  1. Sign in to the Azure portal.

  2. Select Resource groups from the main menu, and click Create.

  1. Select the relevant subscription and provide a unique name for the resource group.

  2. From the Region group drop-down, select the relevant region group, and click Review + Create.

  1. Review the details, and click Create.

Create an Event Hubs namespace

Before creating an Event Hub, the system requires an Event Hubs namespace.

  1. In the Azure portal, select All services.

  2. Type Event Hubs into the search field.

  3. Hover over Event Hubs and click the star to add Event Hubs to the Favorites list.

  1. Under the Favorites tab, select Event Hubs and click Create.

  1. From the drop-down menu in the search field, select the relevant Subscription and Resource group.

  1. Once the namespace is deployed, navigate to the Namespace page.

  • On the Deployment page, select Go to resource to navigate to the page for your namespace.

  • Confirm that you see an Event Hubs Namespace page similar to the following example:

Create an Event Hub

  1. On the Event Hubs page, select Overview > + Event Hub.

  1. Enter a name for the Event Hub and click Review + create.

  1. Review the Event Hub information, and click Create.

  1. Under the Entities tab, select Event Hubs to review a list of Event Hubs.

Register the application with Microsoft Entra ID

To authenticate against Azure, register the application using Microsoft Entra ID (formerly Azure AD).

  1. Sign in to the Azure portal.

  2. Enter Microsoft Entra ID in the search field and select it from the drop-down list.

  3. Select App registrations from the main menu.

  4. Click on + New registration.

  1. Enter a name for the application and click Register.

  1. On the Overview page, copy the Application (client) ID and Directory (tenant) ID. Use these values to get a token from Microsoft Entra ID.

  1. Select Certificates & secrets in the main menu, and click + New client secret.

  1. In the Description field, add a description of the client secret.

  2. From the Expires drop-down, select the expiry period for the application.

  3. Click Add.

  1. Under the Client secrets tab, click the copy icon next to the Value and Secret ID fields to get a token from Microsoft Entra ID.

Add the application to the Event Hubs data sender

Assign your application to the Azure Event Hubs Data Sender role for access.

  1. Select Access control (IAM), and click Add role assignment.

  1. Select Azure Event Hubs Data Sender to role and the application under Members.

  2. Click Review + assign.

In Postman

Use Postman to get a Microsoft Entra token. Authenticate the webhook requests using either:

  • Bearer token

  • OAuth 2.0

Bearer token

  1. Sign in to Postman and create a new request.

  2. Set the method to GET and enter the following URL: https://login.microsoftonline.com/<TENANT_ID>/oauth2/v2.0/token

  1. Under the Headers tab, add the Content-Type key application/x-www-form-urlencoded for the value.

  2. Under the Body tab, select form-data and add the following key-value pairs:

    • grant_type: client_credentials

    • client_id: Paste the client ID from earlier.

    • client_secret: Paste the client secret.

    • resource: https://eventhubs.azure.net

  3. Click Send and save the token. This returns the 200 status code.

OAuth 2.0

  1. In Postman, open a new tab.

  2. Select POST for the method.

  3. Enter the URL in the following format: https://<EVENT HUBS NAMESPACE NAME>.servicebus.windows.net/<QUEUE NAME>/messages. Replace:

    • <EVENT HUBS NAMESPACE NAME> with the name of the Event Hubs namespace.

    • <QUEUE NAME> with the name of the queue—the queue name will be the Event Hub name.

  4. Under the Body tab, select raw for the data type and add the message you want to send in the request.

  1. Select Send. This returns the 201 status code, as shown in the image.

The message is posted on the Event Hubs Namespace page.

In Nexthink

Create webhook credentials

From the Nexthink web interface:

  1. Go to Administration > Connector Credentials in the main menu.

  2. Click New Credential and fill out the following details:

    • Name: Name of the webhook.

    • Description: Meaningful description of the action performed by the webhook.

    • Protocol: Select Hypertext Transfer Protocol Secure (HTTPS). Refer to the Connector credentials for HTTPS section in the Connector credentials documentation.

    • URL for HTTPS protocol

      Enter the URL of the third-party tool in the following format: https://<EVENT HUB NAMESPACE>.servicebus.windows.net/

    • Authorization: Choose the authorization type from the drop-down list.

  1. Save the newly created credential and return to configure a webhook.

Create a webhook in Nexthink

From the Nexthink web interface:

  1. Go to Administration > Outbound Connectors > Webhooks.

  2. Click New Webhook, and complete the form:

    • Name: Enter a name for the webhook.

    • NQL Condition: Configure an NQL query that defines the condition to trigger the webhook.

    • Request Method: POST.

    • Resource: URL of the Event Hub in the format: <EVENT HUB NAME>/messages

    • Payload: JSON payload to be sent to the Event Hub.

  3. Click Send Test to validate the configuration.

  4. Once the configuration is validated, click Save webhook.

Last updated