Skip to main content

Keeping Your Message Queues in Your Own Azure Service Bus

OpenDataDSL keeps your message queues in its own Azure Service Bus namespace, and your applications connect to them with a connection string. You can choose to keep them in an Azure Service Bus namespace in your own Azure subscription instead, so the messages stay in your subscription, your applications connect with their own identities rather than a shared key, and you can monitor and govern the queues with your own tools.

This guide explains what changes, how to give OpenDataDSL access to your namespace, and how your applications connect. If you use Amazon SQS, Apache Kafka or an AMQP 1.0 broker rather than Azure Service Bus, see Keeping your message queues in your own messaging.

What changes​

QueuesWhere they areHow your applications connect
New queuesYour namespace, named <environment>/<your-company>/<queue>With their own Microsoft Entra identity: there is no connection string
Queues you already haveStay in the OpenDataDSL namespace and keep workingWith their connection string, as before

Everything that sends to your queues works as before, wherever the queue is: automations, send in scripts and processes, and the Message Queues extension, which also reads, deletes and moves messages in your namespace. Messages sent by OpenDataDSL are logged in the queue log as usual.

Queues in your namespace can't have a handler (trigger or loader): a handler forwards messages to OpenDataDSL, and Service Bus only forwards messages within one namespace. Keep queues that load data into OpenDataDSL in the OpenDataDSL namespace.

OpenDataDSL signs in to your Microsoft Entra ID tenant as its own application, so you never share a key or password with us. If you have already given OpenDataDSL access to an Azure Batch account or an Azure Key Vault, it is the same application, and you can skip the consent step.

Prerequisites​

You need:

  • An Azure Service Bus namespace in your subscription, in any tier: OpenDataDSL only uses queues
  • A Global Administrator, Cloud Application Administrator or Application Administrator in your Microsoft Entra ID tenant, to grant consent to the OpenDataDSL application
  • An Owner or User Access Administrator on the namespace, to give the application access
  • The OpenDataDSL application (client) ID, shown in the Custom Infrastructure extension (or ask OpenDataDSL support)

Granting consent creates a service principal for the OpenDataDSL application in your Entra ID tenant: the identity you give access to in the next step.

As a tenant administrator, open this URL in a browser, replacing the two placeholders:

https://login.microsoftonline.com/<your-tenant-id>/adminconsent?client_id=<opendatadsl-application-id>

Sign in and accept. You may then be redirected to a page that shows an error. That's expected: consent has still been granted. Alternatively, with the Azure CLI:

az ad sp create --id <opendatadsl-application-id>

Step 2: Give the application the Data Owner role on the namespace​

OpenDataDSL creates, changes and deletes your company's queues, and sends and receives messages on them, so it needs the Azure Service Bus Data Owner role. Assign it on the namespace only.

In the Azure portal: open the Service Bus namespace, select Access control (IAM) > Add > Add role assignment, choose Azure Service Bus Data Owner, then on the Members tab select User, group, or service principal and find OpenDataDSL. Or with the Azure CLI:

az role assignment create \
--assignee <opendatadsl-application-id> \
--role "Azure Service Bus Data Owner" \
--scope /subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/Microsoft.ServiceBus/namespaces/<namespace-name>

OpenDataDSL can't see or change anything else in your subscription. It only creates queues whose names start with <environment>/<your-company>/.

tip

A namespace used only for OpenDataDSL keeps things simple: the role then covers nothing but your OpenDataDSL queues.

Networking​

If the namespace only allows selected networks, OpenDataDSL needs to be allowed in. Ask OpenDataDSL support for the addresses to add.

Step 3: Enter the details in OpenDataDSL​

An administrator of your company in OpenDataDSL (a user with the admin role) chooses Azure Service Bus on the Messaging tab of the Custom Infrastructure extension (Manage > Custom Infrastructure > Messaging), enters the namespace, tests it and saves it. See Custom Infrastructure. The extension also shows the consent link and the role command, filled in for your namespace. If you don't have the extension, send these details to OpenDataDSL support instead:

DetailExampleWhere to find it
Namespace host nameacme-odsl.servicebus.windows.netThe namespace's Overview page, Host name
Entra ID tenant ID00000000-0000-0000-0000-000000000000Microsoft Entra ID > Overview, Tenant ID

The namespace must be in your own Microsoft Entra tenant, the one your company signs in to OpenDataDSL with: OpenDataDSL refuses any other. Only your company's administrators and OpenDataDSL can change where your queues are created.

Connecting your applications​

Give each application that uses a queue a Microsoft Entra identity (a managed identity, or an app registration) and one of these roles on the queue, or on the namespace:

The applicationRole
Sends messagesAzure Service Bus Data Sender
Receives messagesAzure Service Bus Data Receiver

Then connect with the namespace host name and the queue's full name. In Python:

from azure.identity import DefaultAzureCredential
from azure.servicebus import ServiceBusClient

with ServiceBusClient("acme-odsl.servicebus.windows.net", DefaultAzureCredential()) as client:
with client.get_queue_receiver("prod/acme/etrm-prices", max_wait_time=5) as receiver:
for msg in receiver:
print(str(msg))
receiver.complete_message(msg)

The Message Queues extension shows the full name of each queue and the same code for ODSL, Python, JavaScript and C#.

Removing access​

To stop OpenDataDSL using your namespace, select Stop using it on the Messaging tab of the Custom Infrastructure extension (or ask OpenDataDSL support), then remove the role assignment. Queues already in your namespace stay there, but OpenDataDSL can no longer reach them: automations and scripts that send to them fail until each queue is deleted and created again in the OpenDataDSL namespace.

If you remove the role first, everything that sends to your queues fails until access is restored.

Troubleshooting​

SymptomLikely cause
Not found in the directory (AADSTS700016)Consent hasn't been granted in step 1, or the tenant ID sent to OpenDataDSL is wrong
Unauthorized or a missing Manage claimThe Data Owner role is missing, or the role assignment hasn't taken effect yet (it can take a few minutes)
A connection error mentioning IP or network rulesThe namespace's networking settings don't allow OpenDataDSL in
Saving a queue with a handler is refusedHandlers aren't available in your own namespace (see What changes)
Your application can't receiveIts identity needs the Data Receiver role on the queue, and the queue name must be the full name, for example prod/acme/etrm-prices

More information​