Azure DevOps API 创建服务连接而不验证,因此在使用时出现无法查询服务连接 api 的错误

Azure DevOps API creates service connection without verifying hence getting the error failed to query service connection api while using

我能够使用

创建新的服务端点

Create Service EndPoint

并且还能够使用下面的管道权限授予它

curl --request PATCH -H "Content-Type: application/json" -u $user:$token -d "@newpatch.json" https://dev.azure.com/$org/$project/_apis/pipelines/pipelinePermissions/endpoint/$connection_id\?api-version\=5.1-preview.1

但是当我尝试在管道中使用服务连接时,出现以下错误

无法查询服务连接 API:'https://management.azure.com/subscriptions/resourcegroups?api-version=2019-05-01'。状态代码:'BadRequest',来自服务器的响应:'{"error":{"code":"InvalidSubscriptionId","message":"提供的订阅标识符 'resourcegroups' 格式错误或无效。"}} '

我试过 - 但我仍然看到错误,不确定脚本的正文

请帮忙

在 Terraform 任务级别将服务连接作为变量传递导致了问题。

由于它在任务级别不受支持,因此必须在 yaml 中或从变量组中全局定义。问题已解决。