Accessing Message Body in Azure DevOps Runs API

Viewed 95

I am trying to trigger my Azure Pipeline using an HTTP request. I am doing this using the Runs API provided by Azure DevOps, https://docs.microsoft.com/en-us/rest/api/azure/devops/pipelines/runs/run-pipeline?view=azure-devops-rest-6.0

I want to be able to access the message body sent along with the POST request, within my pipeline.

I know that it is possible to do the following,

Add parameters to my pipeline similar to what has been shown below,

parameters:
   - name: id
     type: string

Send the message body of my request to the Runs API within templateParameters to be able to access the values as parameters.

The issue that I am facing is, my pipeline will actually be triggered by a Webhook and as a result, I don't have control over the structure of the message body. I cannot put the data within templateParameters for the values to be accessible through the parameters.

Is there any other way that I can access the values of the message body? Is there some other solution to my problem?

1 Answers

As @Thomas mentioned, the body of the request sent will need to be as defined in the DevOps API, therefore, I had to use an Azure Function as an intermediary to take my initial request, put it inside of templateParameters and re-route it to Azure DevOps.

Related