Search code examples
azureazure-pipelinesazureservicebusazure-pipelines-yamlazure-servicebus-topics

PublishToAzureServiceBus@1 adds serialization to messagebody


When I send a message to an azure servicebus it adds "@string3http://schemas.microsoft.com/2003/10/Serialization/" to the messagebody

I called the messagebus like so:

    - task: PublishToAzureServiceBus@1
      inputs:
        azureSubscription: 'ACCServiceBusVersioning'
        messageBody: |
          {
            "version": "string",
            "state": 0,
            "supportEndDate": "2023-01-18T15:27:35.865Z",
          }
        signPayload: false
        waitForCompletion: false

and expected for it to just send the body to the message but instead the bus recieved

@string3http://schemas.microsoft.com/2003/10/Serialization/�['{
  "version": "string",
  "state": 0,
  "supportEndDate": "2023-01-18T15:27:35.865Z",
}'

Solution

  • oke I fixed it by removing the dataserializer and turned it into a oneline

    messageBody: '{"version": "$(majorVersion).$(minorVersion).$(Build.BuildId)","state": "0","supportEndDate": "9999-12-31 23:59:59"}'
    signPayload: false
    waitForCompletion: false
    useDataContractSerializer: false