Lumberjack
Lumberjack

Reputation: 549

Approving Azure pipeline using API

I'm working on an azure DevOps pipeline. I have an approval stage which stops the pipeline until someone approves the run so the pipeline resumes.

Is there a way, to approve the run with a REST API call? Or is there maybe a way to stop and resume a pipeline using a REST API call without an approval?

(PS. Its a yaml pipeline)

Upvotes: 2

Views: 2408

Answers (1)

Shayki Abramczyk
Shayki Abramczyk

Reputation: 41545

You can use the Approvals Rest API.

First, get the approvals list with Approvals - Query and find your approval id.

Second, approve it with Approvals - Update, in the body use the approvalId you got from the previous step:

[
  {
    "approvalId": "approvalId from the Approvals - Query step",
    "comment": "Approving",
    "status": "approved"
  }
]

Upvotes: 4

Related Questions