【发布时间】:2021-02-17 09:38:51
【问题描述】:
我正在尝试从 powershell 运行以下 API 'Patch' 命令,我希望在 Azure DevOps 中执行一个版本...
$deploy = Invoke-RestMethod -Uri $patchurl -Method Patch -Body $body -Headers $header -ContentType "application/json-patch+json"
网址示例如下
https://vsrm.dev.azure.com/test/Fixed%20Income/_apis/Release/releases/567/environments/1072?api-version=6.0-preview.6
补丁调用的主体是...
"Status": "inProgress",
"scheduledDeploymentTime": null,
"comment": null,
"variables": {}
从 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", “内部异常”:空, "message": "TF400813: 用户 '' 无权访问此资源。", "typeName": "Microsoft.TeamFoundation.Framework.Server.UnauthorizedRequestException, Microsoft.TeamFoundation.Framework.Server", "typeKey": "UnauthorizedRequestException", “错误代码”:0, “eventId”:3000
任何想法我做错了什么?
【问题讨论】:
标签: json powershell api azure-devops