---
title: "How do I send an Azure Service Bus notification when an event occurs?"
slug: "how-do-i-send-an-azure-service-bus-notification-when-an-event-occurs"
updated: 2025-10-14T10:13:14Z
published: 2025-10-14T10:13:14Z
canonical: "support.lusid.com/how-do-i-send-an-azure-service-bus-notification-when-an-event-occurs"
---

> ## Documentation Index
> Fetch the complete documentation index at: https://support.lusid.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How do I send an Azure Service Bus notification when an event occurs?

Providing you are a LUSID user with sufficient access control permissions, you can create a notification to send to [Azure Service Bus](https://azure.microsoft.com/en-us/products/service-bus/) when a system event you have subscribed to occurs.

For example, you could send a Service Bus message to a queue when the LUSID `PortfolioCreated` [event](/v1/docs/what-is-an-event-in-lusid) occurs.

## Using the Notification API

Currently, you can create one notification per API call.

> [!NOTE]
> Note
> 
> You must have already [subscribed to the event](/v1/docs/how-do-i-subscribe-to-an-event) you want to attach the Azure Service Bus notification to.

### Step 1: Supply your Azure credentials in the Configuration Store

Before you can create a notification, you must perform a one-time setup of your Azure credentials in the LUSID Configuration Store.

[Create a configuration set](/v1/docs/how-do-i-upload-information-to-the-configuration-store) containing the following:

| Key | Value |
| --- | --- |
| `namespace` | Your Azure Service Bus [namespace](https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-quickstart-portal#create-a-namespace-in-the-azure-portal) |
| `queueName` | Your Azure Service Bus queue name |
| `tenantId` | Your Azure [tenant ID](https://learn.microsoft.com/en-us/entra/fundamentals/how-to-find-tenant#find-tenant-id-through-the-azure-portal) |
| `clientId` | Your Azure application ID |
| `clientSecret` | Your Azure client secret |

[Read more on how to find these credentials in Azure.](https://learn.microsoft.com/en-us/azure/service-bus-messaging/authenticate-application)

![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/image-3S9UAQOZ.png)

### Step 2: Create a notification

Call the [CreateNotification](https://www.lusid.com/docs/api/notification/endpoints/notifications/CreateNotification/) API for your LUSID domain, passing in your API access token and the following:

- The `scope` and `code` of the subscription to attach the notification to
- A unique `notificationId`
- A friendly `displayName` and `description`
- A `notificationType` containing:
  - `Type`: `AzureServiceBus`
  - `Body`: The notification message; you can use attributes of the event in [mustache templates](/v1/docs/using-mustache-templates-to-enrich-notifications) to make the text more meaningful with dynamic fields
  - `Namespace`: The path to the `namespace` credential in your configuration set from [step 1](/v1/docs/how-do-i-send-an-azure-service-bus-notification-when-an-event-occurs#step-1-supply-your-azure-credentials-in-the-configuration-store) in the format `config://shared/&lt;config-set-scope&gt;/&lt;config-set-code&gt;/namespace`
  - `QueueName`: `config://shared/&lt;config-set-scope&gt;/&lt;config-set-code&gt;/queueName`
  - `TenantId`: `config://shared/&lt;config-set-scope&gt;/&lt;config-set-code&gt;/tenantId`
  - `ClientId`: `config://shared/&lt;config-set-scope&gt;/&lt;config-set-code&gt;/clientId`
  - `ClientSecret`: `config://shared/&lt;config-set-scope&gt;/&lt;config-set-code&gt;/clientSecret`

For example, to attach an Azure Service Bus notification to a subscription with…

- Configuration set scope `Azure` and code `ServiceBus`
- Subscription scope `PortfolioEvents` and code `PortfolioCreated`

…you might send the following:

```json
curl -X POST "https://<your-domain>.lusid.com/notification/api/subscriptions/PortfolioEvents/PortfolioCreated/notifications"
-H "Authorization: Bearer <your-API-access-token>"
-H "Content-Type: application/json"
-d '{
  "notificationId": "AzureServiceBusNotification1",
  "displayName": "AzureServiceBusNotification",
  "description": "PortfolioCreated notification for Azure Service Bus",
  "notificationType": {
    "Type": "AzureServiceBus",
    "Body": "Portfolio created in scope {{Body.portfolioScope}} with code {{Body.portfolioCode}}",
    "Namespace": "config://shared/Azure/ServiceBus/namespace",
    "QueueName": "config://shared/Azure/ServiceBus/queueName",
    "TenantId": "config://shared/Azure/ServiceBus/tenantId",
    "ClientId": "config://shared/Azure/ServiceBus/clientId",
    "ClientSecret": "config://shared/Azure/ServiceBus/clientSecret"
  }
}'
```

> [!NOTE]
> Note
> 
> You can use the `notificationId` to reference the notification in subsequent API calls.

You can create a notification and attach it to a subscription. A notification can trigger people via email or SMS, or a service via Amazon SQS or a webhook. This service can be LUSID itself, or a third party API.

LUSID emits a system event when an internal operation completes. This can be within LUSID itself, or in one of its ecosystem applications such as Drive, Scheduler or Luminesce. For example, when you call the CreatePortfolio API (either directly, or via an SDK, Luminesce, the LUSID web app or any other proxy), LUSID emits a PortfolioCreated system event providing the operation succeeds.
