skip to Main Content

I am using the Azure DevOps REST API to create a serviceendpoint/serviceconnection which works fine. I am using the following endpoint: https://learn.microsoft.com/en-us/rest/api/azure/devops/serviceendpoint/endpoints/create?view=azure-devops-rest-6.0&tabs=HTTP

However we would like to specify a group of approvers as you can do via the Azure DevOps portal like shown in the attached image

enter image description here

Project Settings->Serviceconnections-> Approvals and check

Can this be done via the Azure DevOps REST API?

I reviewed the Microsoft docs with regard to Azure DevOps REST API.

2

Answers


  1. Have not tried this myself, but a little reverse engineering of the Azure DevOps UI leads me to believe there is a generic API object for checks and approvals used by various object types within ADO.

    I think Check Configurations API for approvals and checks is what you need. This does use version 7.1 of the API though.

    Login or Signup to reply.
  2. Project Settings->Serviceconnections-> Approvals and check Can this be done via the Azure DevOps REST API?

    Yes. We can achieve this via Rest API.

    You can use the Rest API: Check Configurations – Add to add approvers to service endpoint.

    Here is an example:

    API URL:

    POST https://dev.azure.com/{organization}/{project}/_apis/pipelines/checks/configurations?api-version=7.1-preview.1
    

    Request Body:

    {
        "type":{
            "id":"8C6F20A7-A545-4486-9777-F762FAFE0D4D",
            "name":"Approval"
            },
        "settings":{
            "approvers":[{
                "displayName":"UserName",
                "id":"UserID",
                "uniqueName":"emailaddress"
               }],
            "executionOrder":1,
            "minRequiredApprovers":0,
            "requesterCannotBeApprover":false},
        "resource":{
            "type":"endpoint",
            "id":"ServiceEndpointID"
        
            },
        "timeout":43200
    }
    

    Result:

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search