Invalid VSTS API environment identifier

I am using the REST API for VSTS to start a release for a specific environment. However, getting the environment and such work, when I make a REST call to start the deployment, I get the following error message:

[DBG]: PS C:\Users\mmulhe200>> 
executeRequest : {"$id":"1","innerException":null,"message":"Environment with ID '16' is not valid. Valid environments have IDs 
'1288,1289'. Specify a valid environment and try 
again.","typeName":"Microsoft.VisualStudio.Services.ReleaseManagement.Data.Exceptions.InvalidRequestException, 
Microsoft.VisualStudio.Services.ReleaseManagement2.Data","typeKey":"InvalidRequestException","errorCode":0,"eventId":3000}
At C:\Users\mmulhe200\Desktop\VSTS release task\test\Untitled1.ps1:58 char:12
+     return executeRequest $request;
+            ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,executeRequest

Interestingly, the response from the REST operation to get the release definition with its environments returns:

...
"id": 16,
"name": "Environment 2",
"rank": 2,
...

In fact, in the whole answer I cannot find ID 1288 or 1289 anywhere. Any thoughts on why VSTS tells me that my environment identifier 16 is wrong, even if it returned from their service?

+4
source share
2 answers

The release environment identifier is not the same as the release environment identifier, maybe there is a problem?

, _apis/release/releases/{releaseid}, _apis/release/definitions/{definitionid}

, https://www.visualstudio.com/en-us/docs/integrate/api/rm/releases#start-deployment-on-an-environment, , , . PATCH {"status":"inprogress"}, PATCH {"status":2}

0

. . , .

1

2

3

enter image description here

0

Source: https://habr.com/ru/post/1656646/


All Articles