Azure DevOps REST api - Run pipeline with variables

0 votes

I have a pipeline on Azure DevOps that I'm trying to run programmatically/headless using the REST API:

 https://docs.microsoft.com/en-us/rest/api/azure/devops/pipelines/runs/run%20pipeline?view=azure-devops-rest-6.0

So far so good, I can auth and start a run. I want to pass data to this pipeline which is possible using variables in the request body, as per the doc. My request body:

{

    "variables": {

        "HELLO_WORLD": {

            "isSecret": false,

            "value": "HelloWorldValue"

        }

    }

}

My pipeline YAML looks like this:

trigger: none

pr: none

pool:

  vmImage: 'ubuntu-latest'

steps:

- task: Bash@3

  inputs:

    targetType: 'inline'

    script: |

      KEY=$(HELLO_WORLD)

      echo "Hello world key: " $KEY

But an error is shown "HELLO_WORLD: command not found". How do you pass variables to a pipeline using the REST API? and how to overcome this error?

Mar 28, 2022 in Other DevOps Questions by Kichu
• 19,050 points
1,752 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Other DevOps Questions

0 votes
0 answers

Azure DevOps REST API Authentication with PKCE

Does Azure DevOps REST API support OAuth ...READ MORE

Apr 17, 2022 in Other DevOps Questions by Kichu
• 19,050 points
478 views
0 votes
0 answers
0 votes
0 answers
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP