正如我在最新版本的文档中看到的 https://learn.microsoft.com/en-us/rest/api/azure/devops/pipelines/runs/run-pipeline?view=azure-devops-rest-7.2
使用此API
POST https://dev.azure.com/{organization}/{project}/_apis/pipelines/{pipelineId}/runs?api-version=7.2-preview.1
我需要oauth2
Authorization URL: https://app.vssps.visualstudio.com/oauth2/authorize&response_type=Assertion Token URL: https://app.vssps.visualstudio.com/oauth2/token?client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer&grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer
如何使用这个?
我知道Azure有多种授权方法,有大量关于如何使用它们的选项。
说实话,我完全被他们搞糊涂了。
不清楚如何使用它们、何时使用、为用户设置什么访问权限以及在请求中发送什么内容?
如果我尝试像这样生成令牌
GET https://login.microsoftonline.com/0000000-0888-00000-be70-0000000/oauth2/v2.0/token Content-Type: application/x-www-form-urlencoded Content-Length: 229 grant_type=password&username=[user]&password=[pass]&client_id=[clientID]&client_secret=[clientSecret]&scope=https%3A%2F%2Fgraph.microsoft.com%2F.default
我成功获得Baerer代币。但是当我在
中使用这个令牌时POST https://dev.azure.com/{organization}/{project}/_apis/pipelines/{pipelineId}/runs?api-version=7.2-preview.1
我的状态为 203,当然我的管道没有运行