Skip to content

Latest commit

 

History

History
258 lines (201 loc) · 9.57 KB

publish-to-azure-service-bus-v1.md

File metadata and controls

258 lines (201 loc) · 9.57 KB
title description ms.date monikerRange
PublishToAzureServiceBus@1 - Publish To Azure Service Bus v1 task
Sends a message to Azure Service Bus using a service connection, with no agent required (task version 1).
07/02/2024
<=azure-pipelines

PublishToAzureServiceBus@1 - Publish To Azure Service Bus v1 task

:::moniker range=">=azure-pipelines-2019.1"

Use this task to send a message to Azure Service Bus using a service connection (no agent is required).

:::moniker-end

:::moniker range="=azure-pipelines-2019"

Use this task to send a message to Azure Service Bus using a service connection (no agent required).

:::moniker-end

Syntax

:::moniker range=">=azure-pipelines-2022.1"

# Publish To Azure Service Bus v1
# Sends a message to Azure Service Bus using a service connection (no agent is required).
- task: PublishToAzureServiceBus@1
  inputs:
    azureSubscription: # string. Alias: connectedServiceName. Required. Azure Service Bus service connection. 
    #messageBody: # string. Message body. 
    #waitForCompletion: false # boolean. Wait for task completion. Default: false.
    #useDataContractSerializer: true # boolean. Use .NET data contract serializer. Default: true.
  # Advanced
    #sessionId: # string. Session Id. 
    #signPayload: false # boolean. Sign the Message. Default: false.
    #certificateString: # string. Required when signPayload = true. Certificate Variable. 
    #signatureKey: 'signature' # string. Optional. Use when signPayload = true. Signature Property Key. Default: signature.

:::moniker-end

:::moniker range=">=azure-pipelines-2019.1 <=azure-pipelines-2022"

# Publish To Azure Service Bus v1
# Sends a message to Azure Service Bus using a service connection (no agent is required).
- task: PublishToAzureServiceBus@1
  inputs:
    azureSubscription: # string. Alias: connectedServiceName. Required. Azure Service Bus service connection. 
    #messageBody: # string. Message body. 
    #waitForCompletion: false # boolean. Wait for task completion. Default: false.
  # Advanced
    #sessionId: # string. Session Id. 
    #signPayload: false # boolean. Sign the Message. Default: false.
    #certificateString: # string. Required when signPayload = true. Certificate Variable. 
    #signatureKey: 'signature' # string. Optional. Use when signPayload = true. Signature Property Key. Default: signature.

:::moniker-end

:::moniker range="=azure-pipelines-2019"

# Publish To Azure Service Bus v1
# Sends a message to azure service bus using a service connection (no agent required).
- task: PublishToAzureServiceBus@1
  inputs:
    azureSubscription: # string. Alias: connectedServiceName. Required. Azure Service Bus service connection. 
    #messageBody: # string. Message body. 
    #waitForCompletion: false # boolean. Wait for task completion. Default: false.
  # Signing Properties
    #signPayload: false # boolean. Sign the Message. Default: false.
    #certificateString: # string. Required when signPayload = true. Certificate Variable. 
    #signatureKey: 'signature' # string. Optional. Use when signPayload = true. Signature Property Key. Default: signature.

:::moniker-end

Inputs

:::moniker range=">=azure-pipelines-2019"

azureSubscription - Azure Service Bus service connection
Input alias: connectedServiceName. string. Required.

Specifies an Azure Service Bus service connection.


:::moniker-end

:::moniker range="<=azure-pipelines"

messageBody - Message body
string.

Specifies the JSON messageBody.


:::moniker-end

:::moniker range=">=azure-pipelines-2019.1"

sessionId - Session Id
string.

Specifies the session ID with which the message is published. For session-based queues, the publishing fails if a value is not specified. For non session-based queues, a value does not need to be specified.


:::moniker-end

:::moniker range="<=azure-pipelines"

signPayload - Sign the Message
boolean. Default value: false.

If set to true, a private certificate will be added to the message.


:::moniker-end

:::moniker range="<=azure-pipelines"

certificateString - Certificate Variable
string. Required when signPayload = true.

Specifies the secret variable that contains the certificate content. This can also be a certificate stored in an Azure key vault that is linked to a variable group used by the release pipeline.


:::moniker-end

:::moniker range=">=azure-pipelines-2019"

signatureKey - Signature Property Key
string. Optional. Use when signPayload = true. Default value: signature.

In Message Properties, specifies the key where the signature is. If left empty, the default value is signature.


:::moniker-end

:::moniker range="<=azure-pipelines"

waitForCompletion - Wait for task completion
boolean. Default value: false.

If set to true, this task will wait for the TaskCompleted event for the specified task timeout.


:::moniker-end

:::moniker range=">=azure-pipelines-2022.1"

useDataContractSerializer - Use .NET data contract serializer.
boolean. Default value: true.

Set useDataContractSerializer to false if you want to pass your message as a stream instead of an object.


:::moniker-end

Task control options

All tasks have control options in addition to their task inputs. For more information, see Control options and common task properties.

Output variables

:::moniker range="<=azure-pipelines"

None.

:::moniker-end

Remarks

Use this task in an agentless job of a release pipeline to send a message to an Azure Service Bus using a service connection (without using an agent).

Note

Can only be used in 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 the task status for agentless tasks. Learn more about Async HTTP agentless tasks.

Requirements

:::moniker range="<=azure-pipelines"

Requirement Description
Pipeline types YAML, Classic build, Classic release
Runs on Server
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command restrictions Any
Settable variables Any
Agent version All supported agent versions.
Task category Utility

:::moniker-end