• /
  • EnglishEspañolFrançais日本語한국어Português
  • Se connecterDémarrer

Azure Service Bus actions

|View as Markdown (English)

The Azure Service Bus actions let you send and receive messages from Azure Service Bus queues directly from your workflows. All actions authenticate using an Azure AD service principal (Entra app registration) and communicate with the Service Bus data plane.

The below actions follow two usage patterns:

  • Send: Use sendMessage to publish a message to a queue.
  • Peek-lock lifecycle: Use peekLockMessage to read and lock a message without removing it, then either completeMessage (processing succeeded — delete it) or unlockMessage (processing abandoned — return it to the queue). Use renewLock to extend the lock during long-running steps. For a simpler, destructive alternative, use receiveAndDeleteMessage to receive and immediately delete a message in one step.

Prerequisites

Send a message

Action identifier: azure.serviceBus.sendMessage

Sends a message to an Azure Service Bus queue.

Input

Type

Description

clientId

String

Required. Entra service-principal client ID. Must be passed as a secret.

clientSecret

String

Required. Entra service-principal client secret. Must be passed as a secret.

tenantId

String

Required. Entra tenant ID. Must be passed as a secret.

namespace

String

Required. Service Bus namespace name, without the .servicebus.windows.net suffix. For example, my-namespace.

queueName

String

Required. Name of the queue to send the message to. For example, my-queue.

body

String

Required. Message body to send (max 256 KB). For example, {"orderId": "12345", "status": "created"}.

contentType

String

Required. Content type of the message body, sent as the Content-Type header. Set explicitly on every call so consumers can correctly interpret the message body. For example, application/json or text/plain.

brokerProperties

Map

Optional. Broker metadata for the message. Accepted keys: Label (String), TimeToLive (Int, seconds), CorrelationId (String), MessageId (String), ReplyTo (String). The executor serializes this map to a JSON-encoded BrokerProperties header — you do not need to pre-serialize it.

selectors

List

Optional. JQ selectors to extract specific fields from the action output. For example, [{"name": "statusCode", "expression": ".response.statusCode"}].

Output

Type

Description

success

Boolean

true on HTTP 201 (message accepted), false on error.

response

Object

Present when success is true; null on error. Contains statusCode (Int). For more information, see the Send Message to Queue REST API.

errorMessage

String

Error message if the send failed. response is null in that case.

name: sendOrderCreatedMessage
description: Send a message to a Service Bus queue
steps:
- name: sendMessage
type: action
action: azure.serviceBus.sendMessage
version: '1'
inputs:
clientId: ${{ :secrets:azure-client-id }}
clientSecret: ${{ :secrets:azure-client-secret }}
tenantId: ${{ :secrets:azure-client-tenant }}
namespace: my-namespace
queueName: my-queue
body: '{"orderId": "12345", "status": "created"}'
contentType: application/json
brokerProperties:
Label: order-created
TimeToLive: 300
selectors:
- name: statusCode
expression: ".response.statusCode"
next: end

Receive and delete a message

Action identifier: azure.serviceBus.receiveAndDeleteMessage

Receives a message from an Azure Service Bus queue and permanently removes it in a single, destructive operation.

Important

Permanently deletes the message on receipt. If the workflow fails after this step, the message cannot be recovered. Use azure.serviceBus.peekLockMessage instead when the processing step might fail and you need the ability to retry.

Input

Type

Description

clientId

String

Required. Entra service-principal client ID. Must be passed as a secret.

clientSecret

String

Required. Entra service-principal client secret. Must be passed as a secret.

tenantId

String

Required. Entra tenant ID. Must be passed as a secret.

namespace

String

Required. Service Bus namespace name, without the .servicebus.windows.net suffix.

queueName

String

Required. Name of the queue to receive from.

timeoutSeconds

Integer

Optional. How long to wait for a message before returning empty (1–55 seconds). The 55-second ceiling is a New Relic platform limit, not an Azure constraint. Default: 5.

selectors

List

Optional. JQ selectors to extract specific fields from the action output. For example, [{"name": "body", "expression": ".response.body"}].

Output

Type

Description

success

Boolean

true for both a message found (HTTP 200) and an empty queue (HTTP 204). Check messageFound to distinguish between the two.

messageFound

Boolean

Top-level output (not inside response). true if a message was returned; false if the queue was empty (HTTP 204). An empty queue is not an error.

response

Object

Present when success is true; null on error. Contains statusCode (Int), body (String, the message body), and brokerProperties (Map, including fields such as MessageId, SequenceNumber, DeliveryCount, and EnqueuedTimeUtc). For more information, see the Receive and Delete Message REST API.

errorMessage

String

Error message if the receive failed. response is null in that case.

name: drainQueueMessage
description: Receive and permanently delete the next message from a queue
steps:
- name: receiveAndDeleteMessage
type: action
action: azure.serviceBus.receiveAndDeleteMessage
version: '1'
inputs:
clientId: ${{ :secrets:azure-client-id }}
clientSecret: ${{ :secrets:azure-client-secret }}
tenantId: ${{ :secrets:azure-client-tenant }}
namespace: my-namespace
queueName: my-queue
timeoutSeconds: 30
selectors:
- name: messageFound
expression: ".messageFound"
- name: body
expression: ".response.body"
next: end

Peek-lock a message

Action identifier: azure.serviceBus.peekLockMessage

Reads a message from an Azure Service Bus queue without removing it, and temporarily locks it so other consumers cannot see it while it is being processed. Returns a location value that you must pass to completeMessage, unlockMessage, or renewLock in subsequent steps.

Important

location is a top-level output — reference it as .steps.<stepName>.outputs.location, not .steps.<stepName>.outputs.response.location. Reuse this same value in every subsequent renewLock, completeMessage, or unlockMessage step — renewLock does not echo location back as an output.

Input

Type

Description

clientId

String

Required. Entra service-principal client ID. Must be passed as a secret.

clientSecret

String

Required. Entra service-principal client secret. Must be passed as a secret.

tenantId

String

Required. Entra tenant ID. Must be passed as a secret.

namespace

String

Required. Service Bus namespace name, without the .servicebus.windows.net suffix.

queueName

String

Required. Name of the queue to peek-lock from.

timeoutSeconds

Integer

Optional. How long to wait for a message before returning empty (1–55 seconds). The 55-second ceiling is a New Relic platform limit, not an Azure constraint. Default: 5.

selectors

List

Optional. JQ selectors to extract specific fields from the action output. For example, [{"name": "location", "expression": ".location"}].

Output

Type

Description

success

Boolean

true for both a message found (HTTP 201) and an empty queue (HTTP 204). Check messageFound to distinguish between the two.

messageFound

Boolean

Top-level output (not inside response). true if a message was returned and locked; false if the queue was empty (HTTP 204). An empty queue is not an error.

location

String

Top-level output (not inside response). The Service Bus Location header value identifying the locked message. Pass this value unchanged to completeMessage, unlockMessage, or renewLock. Present only when a message was found.

response

Object

Present when success is true; null on error. Contains statusCode (Int), body (String, the message body), and brokerProperties (Map, including LockToken and LockedUntilUtc). For more information, see the Peek-Lock Message REST API.

errorMessage

String

Error message if the peek-lock failed. response is null in that case.

name: peekLockAndComplete
description: Peek-lock a message then mark it as processed
steps:
- name: peekLockMessage
type: action
action: azure.serviceBus.peekLockMessage
version: '1'
inputs:
clientId: ${{ :secrets:azure-client-id }}
clientSecret: ${{ :secrets:azure-client-secret }}
tenantId: ${{ :secrets:azure-client-tenant }}
namespace: my-namespace
queueName: my-queue
timeoutSeconds: 30
selectors:
- name: messageFound
expression: ".messageFound"
- name: location
expression: ".location"
- name: body
expression: ".response.body"
- name: completeMessage
type: action
action: azure.serviceBus.completeMessage
version: '1'
inputs:
clientId: ${{ :secrets:azure-client-id }}
clientSecret: ${{ :secrets:azure-client-secret }}
tenantId: ${{ :secrets:azure-client-tenant }}
namespace: my-namespace
location: ${{ .steps.peekLockMessage.outputs.location }}
next: end

Renew a message lock

Action identifier: azure.serviceBus.renewLock

Extends the lock duration on a peek-locked Azure Service Bus message, preventing the lock from expiring while a long-running workflow step is still processing it.

Important

Does not return a location output. Azure's renew-lock response has no Location header. Continue referencing the original peekLockMessage.outputs.location value in every subsequent renewLock, completeMessage, and unlockMessage step — do not read location from a prior renewLock output. Returns HTTP 404 if called after the lock has already expired.

Input

Type

Description

clientId

String

Required. Entra service-principal client ID. Must be passed as a secret.

clientSecret

String

Required. Entra service-principal client secret. Must be passed as a secret.

tenantId

String

Required. Entra tenant ID. Must be passed as a secret.

namespace

String

Required. Service Bus namespace name, without the .servicebus.windows.net suffix.

location

String

Required. The location output from a prior peekLockMessage step. Use it unchanged — do not construct this value manually.

selectors

List

Optional. JQ selectors to extract specific fields from the action output.

Output

Type

Description

success

Boolean

true on HTTP 200 (lock renewed), false on error. HTTP 404 (lock expired) returns success: false with errorMessage set.

response

Object

Present only when success is true; null on error. Contains statusCode (always 200 when present). For more information, see the Renew Lock for a Message REST API.

errorMessage

String

Error message if the renew failed, for example because the lock already expired (HTTP 404). response is null in that case.

name: renewLockDuringProcessing
description: Peek-lock a message, wait, renew the lock, then complete it
steps:
- name: peekLockMessage
type: action
action: azure.serviceBus.peekLockMessage
version: '1'
inputs:
clientId: ${{ :secrets:azure-client-id }}
clientSecret: ${{ :secrets:azure-client-secret }}
tenantId: ${{ :secrets:azure-client-tenant }}
namespace: my-namespace
queueName: my-queue
timeoutSeconds: 30
selectors:
- name: location
expression: ".location"
- name: processMessage
type: wait
seconds: 15
- name: renewLock
type: action
action: azure.serviceBus.renewLock
version: '1'
inputs:
clientId: ${{ :secrets:azure-client-id }}
clientSecret: ${{ :secrets:azure-client-secret }}
tenantId: ${{ :secrets:azure-client-tenant }}
namespace: my-namespace
location: ${{ .steps.peekLockMessage.outputs.location }}
- name: completeMessage
type: action
action: azure.serviceBus.completeMessage
version: '1'
inputs:
clientId: ${{ :secrets:azure-client-id }}
clientSecret: ${{ :secrets:azure-client-secret }}
tenantId: ${{ :secrets:azure-client-tenant }}
namespace: my-namespace
location: ${{ .steps.peekLockMessage.outputs.location }}
next: end

Complete a message

Action identifier: azure.serviceBus.completeMessage

Marks a peek-locked Azure Service Bus message as successfully processed, permanently deleting it from the queue. This is the terminal "success" step of the peek-lock pattern.

Input

Type

Description

clientId

String

Required. Entra service-principal client ID. Must be passed as a secret.

clientSecret

String

Required. Entra service-principal client secret. Must be passed as a secret.

tenantId

String

Required. Entra tenant ID. Must be passed as a secret.

namespace

String

Required. Service Bus namespace name, without the .servicebus.windows.net suffix.

location

String

Required. The location output from a prior peekLockMessage step. Use it unchanged — do not construct this value manually.

selectors

List

Optional. JQ selectors to extract specific fields from the action output.

Output

Type

Description

success

Boolean

true on HTTP 200 (message deleted), false on error. HTTP 404 (lock expired or message not found) returns success: false with errorMessage set.

response

Object

Present only when success is true; null on error. Contains statusCode (always 200 when present). For more information, see the Delete Message REST API.

errorMessage

String

Error message if the complete operation failed, for example because the lock expired (HTTP 404). response is null in that case.

name: peekLockAndComplete
description: Peek-lock a message and mark it as successfully processed
steps:
- name: peekLockMessage
type: action
action: azure.serviceBus.peekLockMessage
version: '1'
inputs:
clientId: ${{ :secrets:azure-client-id }}
clientSecret: ${{ :secrets:azure-client-secret }}
tenantId: ${{ :secrets:azure-client-tenant }}
namespace: my-namespace
queueName: my-queue
timeoutSeconds: 30
selectors:
- name: location
expression: ".location"
- name: completeMessage
type: action
action: azure.serviceBus.completeMessage
version: '1'
inputs:
clientId: ${{ :secrets:azure-client-id }}
clientSecret: ${{ :secrets:azure-client-secret }}
tenantId: ${{ :secrets:azure-client-tenant }}
namespace: my-namespace
location: ${{ .steps.peekLockMessage.outputs.location }}
next: end

Unlock a message

Action identifier: azure.serviceBus.unlockMessage

Releases the lock on a peek-locked Azure Service Bus message, making it immediately available again for other consumers. This is the terminal "abandon" step of the peek-lock pattern — use it when the workflow determines it cannot or should not finish processing the message.

Input

Type

Description

clientId

String

Required. Entra service-principal client ID. Must be passed as a secret.

clientSecret

String

Required. Entra service-principal client secret. Must be passed as a secret.

tenantId

String

Required. Entra tenant ID. Must be passed as a secret.

namespace

String

Required. Service Bus namespace name, without the .servicebus.windows.net suffix.

location

String

Required. The location output from a prior peekLockMessage step. Use it unchanged — do not construct this value manually.

selectors

List

Optional. JQ selectors to extract specific fields from the action output.

Output

Type

Description

success

Boolean

true on HTTP 200 (lock released), false on error. HTTP 404 (lock expired or message not found) returns success: false with errorMessage set.

response

Object

Present only when success is true; null on error. Contains statusCode (always 200 when present). For more information, see the Unlock Message REST API.

errorMessage

String

Error message if the unlock failed, for example because the lock expired (HTTP 404). response is null in that case.

name: peekLockAndAbandon
description: Peek-lock a message then release it back to the queue unprocessed
steps:
- name: peekLockMessage
type: action
action: azure.serviceBus.peekLockMessage
version: '1'
inputs:
clientId: ${{ :secrets:azure-client-id }}
clientSecret: ${{ :secrets:azure-client-secret }}
tenantId: ${{ :secrets:azure-client-tenant }}
namespace: my-namespace
queueName: my-queue
timeoutSeconds: 30
selectors:
- name: location
expression: ".location"
- name: unlockMessage
type: action
action: azure.serviceBus.unlockMessage
version: '1'
inputs:
clientId: ${{ :secrets:azure-client-id }}
clientSecret: ${{ :secrets:azure-client-secret }}
tenantId: ${{ :secrets:azure-client-tenant }}
namespace: my-namespace
location: ${{ .steps.peekLockMessage.outputs.location }}
next: end
Droits d'auteur © 2026 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.