Publish To Azure Service Bus task

Azure Pipelines

Use this task in a build or release pipeline to send a message to an Azure Service Bus using a service connection and without using an agent.

Demands

Can be used in only an agentless job of a release pipeline.

YAML snippet

# Publish To Azure Service Bus
# Sends a message to Azure Service Bus using a service connection (no agent is required)
- task: PublishToAzureServiceBus@1
  inputs:
    azureSubscription: 
    #messageBody: # Optional
    #sessionId: # Optional
    #signPayload: false 
    #certificateString: # Required when signPayload == True
    #signatureKey: 'signature' # Optional
    #waitForCompletion: false 

Arguments

Parameter Comments
Display name Required. The name to display for this task.
Azure Service Bus Connection Required. An existing service connection to an Azure Service Bus.
Message body Required. The text of the message body to send to the Service Bus.
Wait for Task Completion Optional. Set this option to force the task to halt until a response is received.
Control options See Control options

Open source

This task is open source on GitHub. Feedback and contributions are welcome.

Q & A

Do I need an agent?

You do not need an agent to run this task. This task Can be used in only an agentless job of a release pipeline.

Where should a task signal completion?

To signal completion, the external service should POST completion data to the following pipelines REST endpoint.

{planUri}/{projectId}/_apis/distributedtask/hubs/{hubName}/plans/{planId}/events?api-version=2.0-preview.1

**Request Body**
 { "name": "TaskCompleted", "taskId": "taskInstanceId", "jobId": "jobId", "result": "succeeded" }

See this simple cmdline application for specifics.

In addition, a C# helper library is available to enable live logging and managing task status for agentless tasks. Learn more