0
votes

After updating the service connection(with change in service principle Key) using a PUT method, I want to verify the service connection status using REST API.

https://docs.microsoft.com/en-us/rest/api/azure/devops/serviceendpoint/endpoints/update%20service%20endpoint?view=azure-devops-rest-5.0

enter image description here

I tried to use the isReady flag what we GET in service endpoint json response, however it does not reflect though I update the service connection with wrong SPN key.

 "isReady":true,
1

1 Answers

1
votes

Based on my test, this Update Service Connection Rest API will not verify whether the connection is successful.

It will directly update the service connection(save without verification).

For authentication of this service connection:

You need to run another Rest API to verify it: Endpointproxy - Execute Service Endpoint Request

This Rest API is used to verify whether the service connection is successful.

Here is an example:

Rest API:

Post https://dev.azure.com/{Organization Name}/{Project Name}/_apis/serviceendpoint/endpointproxy?endpointId={EndpointID}&api-version=6.0-preview.1

Request Body:

{  
 "dataSourceDetails":{"dataSourceName":"TestConnection"}

}

Result:

Success

enter image description here

Fail

enter image description here