Sending data to Azure Event Hubs
Last updated
Last updated
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.
Before you start, ensure you have the following:
Azure account
Postman account
Nexthink license
A resource group is a logical container for Azure resources.
Sign in to the Azure portal.
Select Resource groups from the main menu, and click Create.
Select the relevant subscription and provide a unique name for the resource group.
From the Region group drop-down, select the relevant region group, and click Review + Create.
Review the details, and click Create.
Before creating an Event Hub, the system requires an Event Hubs namespace.
In the Azure portal, select All services.
Type Event Hubs into the search field.
Hover over Event Hubs and click the star to add Event Hubs to the Favorites list.
Under the Favorites tab, select Event Hubs and click Create.
From the drop-down menu in the search field, select the relevant Subscription and Resource group.
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:
On the Event Hubs page, select Overview > + Event Hub.
Enter a name for the Event Hub and click Review + create.
Review the Event Hub information, and click Create.
Under the Entities tab, select Event Hubs to review a list of Event Hubs.
To authenticate against Azure, register the application using Microsoft Entra ID (formerly Azure AD).
Sign in to the Azure portal.
Enter Microsoft Entra ID in the search field and select it from the drop-down list.
Select App registrations from the main menu.
Click on + New registration.
Enter a name for the application and click Register.
On the Overview page, copy the Application (client) ID and Directory (tenant) ID. Use these values to get a token from Microsoft Entra ID.
Select Certificates & secrets in the main menu, and click + New client secret.
In the Description field, add a description of the client secret.
From the Expires drop-down, select the expiry period for the application.
Click Add.
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.
Assign your application to the Azure Event Hubs Data Sender role for access.
Select Access control (IAM), and click Add role assignment.
Select Azure Event Hubs Data Sender to role and the application under Members.
Click Review + assign.
Use Postman to get a Microsoft Entra token. Authenticate the webhook requests using either:
Bearer token
OAuth 2.0
Sign in to Postman and create a new request.
Set the method to GET and enter the following URL:
https://login.microsoftonline.com/<TENANT_ID>/oauth2/v2.0/token
Under the Headers tab, add the Content-Type key application/x-www-form-urlencoded
for the value.
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
Click Send and save the token. This returns the 200 status code.
In Postman, open a new tab.
Select POST for the method.
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.
Under the Body tab, select raw for the data type and add the message you want to send in the request.
Select Send. This returns the 201 status code, as shown in the image.
The message is posted on the Event Hubs Namespace page.
From the Nexthink web interface:
Go to Administration > Connector Credentials in the main menu.
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.
Save the newly created credential and return to configure a webhook.
From the Nexthink web interface:
Go to Administration > Outbound Connectors > Webhooks.
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.
Click Send Test to validate the configuration.
Once the configuration is validated, click Save webhook.