1

Having looked through the Azure DevOps REST API documentation, and a few failed attempts at guessing the endpoint, there doesn't appear to be any mention of how to view or create 'Approvals and checks' associated with a given service connection:

https://learn.microsoft.com/en-us/rest/api/azure/devops/serviceendpoint/endpoints?view=azure-devops-rest-6.1

enter image description here

Are there any ideas on how to do this, or where the Rest API documentation for approvals/checks for service connections are?

For background information, when creating a service connection via the REST API we are aiming to assign a check to the service connection so that it uses a given YAML template, as the service connections themselves are already being created as part of an automated flow.

Jordan
  • 13
  • 1
  • 5

1 Answers1

-1

You can use an unrecorded REST API:

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

Here is an example of its request body:

{
    "type": {
        "name": "ExtendsCheck"
    },
    "settings": {
        "extendsChecks": [
            {
                "repositoryType": "git",
                "repositoryName": "{project}/{repository}",
                "repositoryRef": "refs/heads/master",
                "templatePath": "templates.yml"
            }
        ]
    },
    "resource": {
        "type": "endpoint",
        "id": "{service connection id}",
        "name": "{service connection name}"
    }
}

To get the service connection id, you can use the REST API Endpoints - Get Service Endpoints or Endpoints - Get Service Endpoints By Names.

Jane Ma-MSFT
  • 4,461
  • 1
  • 6
  • 12