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:
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.
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.