I'm trying to run the following API 'Patch' command from powershell which I'm looking to execute a release in Azure DevOps ...
$deploy = Invoke-RestMethod -Uri $patchurl -Method Patch -Body $body -Headers $header -ContentType "application/json-patch+json"
The url example is below
https://vsrm.dev.azure.com/test/Fixed%20Income/_apis/Release/releases/567/environments/1072?api-version=6.0-preview.6
The body of the patch call is ...
"Status": "inProgress",
"scheduledDeploymentTime": null,
"comment": null,
"variables": {}
Running the invoke command from powershell returns the following response ...
Invoke-RestMethod : {"$id":"1","innerException":null,"message":"TF400898: An Internal Error Occurred. Activity Id: 759888ab-9828-4cb6-ba2f-e90cde1cd39a.","typeName":"System.Web.Http.HttpResponseException, System.Web.Http","typeKey":"HttpResponseException","errorCode":0,"eventId":0}
When I run the same url to run a 'patch' request from Postman I get the below response, which is what I'm expecting to get from Powershell.
"$id": "1", "innerException": null, "message": "TF400813: The user '' is not authorized to access this resource.", "typeName": "Microsoft.TeamFoundation.Framework.Server.UnauthorizedRequestException, Microsoft.TeamFoundation.Framework.Server", "typeKey": "UnauthorizedRequestException", "errorCode": 0, "eventId": 3000
Any ideas what I'm doing wrong?