【问题标题】:REST API to get the status of Azure DevOps service Connection用于获取 Azure DevOps 服务连接状态的 REST API
【发布时间】:2020-10-19 12:35:08
【问题描述】:

使用PUT方法更新服务连接(改变服务原理Key)后,我想使用REST API验证服务连接状态。

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

我尝试使用isReady 标记我们在服务端点 json 响应中获取的内容,但是尽管我使用错误的 SPN 密钥更新了服务连接,但它并没有反映出来。

 "isReady":true,

【问题讨论】:

    标签: rest azure-devops azure-active-directory


    【解决方案1】:

    根据我的测试,这个Update Service Connection Rest API不会验证连接是否成功。

    会直接更新服务连接(不验证保存)。

    对于此服务连接的身份验证:

    您需要运行另一个 Rest API 来验证它:Endpointproxy - Execute Service Endpoint Request

    这个Rest API用来验证服务连接是否成功。

    这是一个例子:

    休息 API:

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

    请求正文:

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

    结果:

    成功

    失败

    【讨论】:

    • 谢谢@Kevin!正是我想要的。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-05
    • 1970-01-01
    • 2021-03-25
    • 1970-01-01
    • 2021-02-21
    相关资源
    最近更新 更多