我正在尝试从 powershell 运行以下 API“Patch”命令,我希望在 Azure DevOps 中执行发布...
$deploy = Invoke-RestMethod -Uri $patchurl -Method Patch -Body $body -Headers $header -ContentType "application/json-patch+json"
Run Code Online (Sandbox Code Playgroud)
网址示例如下
https://vsrm.dev.azure.com/test/Fixed%20Income/_apis/Release/releases/567/environments/1072?api-version=6.0-preview.6
Run Code Online (Sandbox Code Playgroud)
补丁调用的主体是...
"Status": "inProgress",
"scheduledDeploymentTime": null,
"comment": null,
"variables": {}
Run Code Online (Sandbox Code Playgroud)
从 powershell 运行调用命令会返回以下响应...
Invoke-RestMethod : {"$id":"1","innerException":null,"message":"TF400898: 发生内部错误。活动 ID: 759888ab-9828-4cb6-ba2f-e90cde1cd39a。","typeName" :“System.Web.Http.HttpResponseException,System.Web.Http”,“typeKey”:“HttpResponseException”,“errorCode”:0,“eventId”:0}
当我运行相同的 url 来运行来自 Postman 的“补丁”请求时,我收到以下响应,这正是我期望从 Powershell 获得的响应。
“$id”:“1”,“innerException”:null,“message”:“TF400813:用户''无权访问此资源。”,“typeName”:“Microsoft.TeamFoundation.Framework.Server.UnauthorizedRequestException ,Microsoft.TeamFoundation.Framework.Server”,“typeKey”:“UnauthorizedRequestException”,“errorCode”:0,“eventId”:3000
有什么想法我做错了吗?