Azure DevOps: how to update release scoped variables using REST API Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Creating VSTS ServiceHooks (WebHooks) via Rest Api for work item created event fails. Please give a solutionVSTS Items REST API, wildcard not allowedUsing VSTS Rest API, how do you Update a Markdown widget?Create release with title using VSTS REST APICan not update release definition through APIVSTS REST API CachingUnable to update last rundetails in vsts via Rest APIAzure DevOps git policy configurations api broken?How many items we can retrieve at single call in Azure dev ops rest api?No description of attributes in Get Diagnostic Logs in Azure DevOps REST API

One-one communication

NIntegrate on a solution of a matrix ODE

The test team as an enemy of development? And how can this be avoided?

How could a hydrazine and N2O4 cloud (or it's reactants) show up in weather radar?

Twin's vs. Twins'

Can gravitational waves pass through a black hole?

Did any compiler fully use 80-bit floating point?

Is it OK to use the testing sample to compare algorithms?

Noise in Eigenvalues plot

How can I prevent/balance waiting and turtling as a response to cooldown mechanics

An isoperimetric-type inequality inside a cube

Is there a spell that can create a permanent fire?

Why not use the yoke to control yaw, as well as pitch and roll?

Improvising over quartal voicings

Was the pager message from Nick Fury to Captain Marvel unnecessary?

Does the universe have a fixed centre of mass?

Are there any irrational/transcendental numbers for which the distribution of decimal digits is not uniform?

How to resize main filesystem

Do i imagine the linear (straight line) homotopy in a correct way?

How does TikZ render an arc?

New Order #6: Easter Egg

Why are two-digit numbers in Jonathan Swift's "Gulliver's Travels" (1726) written in "German style"?

Fit odd number of triplets in a measure?

Keep at all times, the minus sign above aligned with minus sign below



Azure DevOps: how to update release scoped variables using REST API



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!Creating VSTS ServiceHooks (WebHooks) via Rest Api for work item created event fails. Please give a solutionVSTS Items REST API, wildcard not allowedUsing VSTS Rest API, how do you Update a Markdown widget?Create release with title using VSTS REST APICan not update release definition through APIVSTS REST API CachingUnable to update last rundetails in vsts via Rest APIAzure DevOps git policy configurations api broken?How many items we can retrieve at single call in Azure dev ops rest api?No description of attributes in Get Diagnostic Logs in Azure DevOps REST API



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















I am trying to update release scoped variables for the existing release using API.



Issue: receiving exception on API call (PUT https://vsrm.dev.azure.com/organization/project/_apis/release/releases/releaseId?api-version=5.1-preview.8)



Invoke-RestMethod : "$id":"1","innerException":null,"message":"You are using an old copy of release. Refresh your copy and try
again.","typeName":"Microsoft.VisualStudio.Services.ReleaseManagement.Data.Exceptions.InvalidRequestException,
Microsoft.VisualStudio.Services.ReleaseManagement2.Data","typeKey":"InvalidRequestException","errorCode":0,"eventId":3000


Steps to Recreate:



  1. Create release from existing release definition without triggering any stages on the web portal: https://vsrm.dev.azure.com

  2. Get release details by invoking:
    GET https://vsrm.dev.azure.com/organization/project/_apis/release/releases/releaseId?api-version=5.1-preview.8

  3. Update response from step 2 with value for release scoped variable with "allowOverride" set to true

  4. Update response from step 2 with "modifiedOn" property set to later date than existing value

  5. Update response from step 2 with "definitionSnapshotRevision" property set to existing value incremented by 1

  6. Update release by invoking:
    PUT https://vsrm.dev.azure.com/organization/project/_apis/release/releases/releaseId?api-version=5.1-preview.8
    and providing json generated in steps 2-5

  7. Observe above mentioned exception

I have updated 2 release properties (modifiedOn and definitionSnapshotRevision) because I saw that these values change if I update a release using web site (https://vsrm.dev.azure.com). It seems that I am still missing something. I cannot find any guidance in documentation on how to properly update a release deployment.










share|improve this question






























    1















    I am trying to update release scoped variables for the existing release using API.



    Issue: receiving exception on API call (PUT https://vsrm.dev.azure.com/organization/project/_apis/release/releases/releaseId?api-version=5.1-preview.8)



    Invoke-RestMethod : "$id":"1","innerException":null,"message":"You are using an old copy of release. Refresh your copy and try
    again.","typeName":"Microsoft.VisualStudio.Services.ReleaseManagement.Data.Exceptions.InvalidRequestException,
    Microsoft.VisualStudio.Services.ReleaseManagement2.Data","typeKey":"InvalidRequestException","errorCode":0,"eventId":3000


    Steps to Recreate:



    1. Create release from existing release definition without triggering any stages on the web portal: https://vsrm.dev.azure.com

    2. Get release details by invoking:
      GET https://vsrm.dev.azure.com/organization/project/_apis/release/releases/releaseId?api-version=5.1-preview.8

    3. Update response from step 2 with value for release scoped variable with "allowOverride" set to true

    4. Update response from step 2 with "modifiedOn" property set to later date than existing value

    5. Update response from step 2 with "definitionSnapshotRevision" property set to existing value incremented by 1

    6. Update release by invoking:
      PUT https://vsrm.dev.azure.com/organization/project/_apis/release/releases/releaseId?api-version=5.1-preview.8
      and providing json generated in steps 2-5

    7. Observe above mentioned exception

    I have updated 2 release properties (modifiedOn and definitionSnapshotRevision) because I saw that these values change if I update a release using web site (https://vsrm.dev.azure.com). It seems that I am still missing something. I cannot find any guidance in documentation on how to properly update a release deployment.










    share|improve this question


























      1












      1








      1








      I am trying to update release scoped variables for the existing release using API.



      Issue: receiving exception on API call (PUT https://vsrm.dev.azure.com/organization/project/_apis/release/releases/releaseId?api-version=5.1-preview.8)



      Invoke-RestMethod : "$id":"1","innerException":null,"message":"You are using an old copy of release. Refresh your copy and try
      again.","typeName":"Microsoft.VisualStudio.Services.ReleaseManagement.Data.Exceptions.InvalidRequestException,
      Microsoft.VisualStudio.Services.ReleaseManagement2.Data","typeKey":"InvalidRequestException","errorCode":0,"eventId":3000


      Steps to Recreate:



      1. Create release from existing release definition without triggering any stages on the web portal: https://vsrm.dev.azure.com

      2. Get release details by invoking:
        GET https://vsrm.dev.azure.com/organization/project/_apis/release/releases/releaseId?api-version=5.1-preview.8

      3. Update response from step 2 with value for release scoped variable with "allowOverride" set to true

      4. Update response from step 2 with "modifiedOn" property set to later date than existing value

      5. Update response from step 2 with "definitionSnapshotRevision" property set to existing value incremented by 1

      6. Update release by invoking:
        PUT https://vsrm.dev.azure.com/organization/project/_apis/release/releases/releaseId?api-version=5.1-preview.8
        and providing json generated in steps 2-5

      7. Observe above mentioned exception

      I have updated 2 release properties (modifiedOn and definitionSnapshotRevision) because I saw that these values change if I update a release using web site (https://vsrm.dev.azure.com). It seems that I am still missing something. I cannot find any guidance in documentation on how to properly update a release deployment.










      share|improve this question
















      I am trying to update release scoped variables for the existing release using API.



      Issue: receiving exception on API call (PUT https://vsrm.dev.azure.com/organization/project/_apis/release/releases/releaseId?api-version=5.1-preview.8)



      Invoke-RestMethod : "$id":"1","innerException":null,"message":"You are using an old copy of release. Refresh your copy and try
      again.","typeName":"Microsoft.VisualStudio.Services.ReleaseManagement.Data.Exceptions.InvalidRequestException,
      Microsoft.VisualStudio.Services.ReleaseManagement2.Data","typeKey":"InvalidRequestException","errorCode":0,"eventId":3000


      Steps to Recreate:



      1. Create release from existing release definition without triggering any stages on the web portal: https://vsrm.dev.azure.com

      2. Get release details by invoking:
        GET https://vsrm.dev.azure.com/organization/project/_apis/release/releases/releaseId?api-version=5.1-preview.8

      3. Update response from step 2 with value for release scoped variable with "allowOverride" set to true

      4. Update response from step 2 with "modifiedOn" property set to later date than existing value

      5. Update response from step 2 with "definitionSnapshotRevision" property set to existing value incremented by 1

      6. Update release by invoking:
        PUT https://vsrm.dev.azure.com/organization/project/_apis/release/releases/releaseId?api-version=5.1-preview.8
        and providing json generated in steps 2-5

      7. Observe above mentioned exception

      I have updated 2 release properties (modifiedOn and definitionSnapshotRevision) because I saw that these values change if I update a release using web site (https://vsrm.dev.azure.com). It seems that I am still missing something. I cannot find any guidance in documentation on how to properly update a release deployment.







      azure-devops azure-pipelines-release-pipeline azure-devops-rest-api






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Feb 19 at 18:27







      ExaStep

















      asked Feb 18 at 21:21









      ExaStepExaStep

      63




      63






















          1 Answer
          1






          active

          oldest

          votes


















          0














          I used "Invoke-RestMethod" powershell commandlet to get release metadata. This commandlet returns custom ps object which I then updated, converted to json using "ConvertTo-Json" commandlet and provided in the body of the PUT HTTP request to DevOps to update the release. The issue is that Powershell serialization/de-serialization process of json does not result to the original json.
          For example this json property:



          "preDeploymentGatesSnapshot": 
          "id": 0,
          "gatesOptions": null,
          "gates": []
          ,


          becomes:



          "preDeploymentGatesSnapshot": "@id=0; gatesOptions=; gates=System.Object[]"


          After I used correct json in the body of the PUT request in the API call:




          https://vsrm.dev.azure.com/organization/project/_apis/release/releases/releaseId?api-version=5.1-preview.8




          the release got successfully updated.






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54755547%2fazure-devops-how-to-update-release-scoped-variables-using-rest-api%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            I used "Invoke-RestMethod" powershell commandlet to get release metadata. This commandlet returns custom ps object which I then updated, converted to json using "ConvertTo-Json" commandlet and provided in the body of the PUT HTTP request to DevOps to update the release. The issue is that Powershell serialization/de-serialization process of json does not result to the original json.
            For example this json property:



            "preDeploymentGatesSnapshot": 
            "id": 0,
            "gatesOptions": null,
            "gates": []
            ,


            becomes:



            "preDeploymentGatesSnapshot": "@id=0; gatesOptions=; gates=System.Object[]"


            After I used correct json in the body of the PUT request in the API call:




            https://vsrm.dev.azure.com/organization/project/_apis/release/releases/releaseId?api-version=5.1-preview.8




            the release got successfully updated.






            share|improve this answer



























              0














              I used "Invoke-RestMethod" powershell commandlet to get release metadata. This commandlet returns custom ps object which I then updated, converted to json using "ConvertTo-Json" commandlet and provided in the body of the PUT HTTP request to DevOps to update the release. The issue is that Powershell serialization/de-serialization process of json does not result to the original json.
              For example this json property:



              "preDeploymentGatesSnapshot": 
              "id": 0,
              "gatesOptions": null,
              "gates": []
              ,


              becomes:



              "preDeploymentGatesSnapshot": "@id=0; gatesOptions=; gates=System.Object[]"


              After I used correct json in the body of the PUT request in the API call:




              https://vsrm.dev.azure.com/organization/project/_apis/release/releases/releaseId?api-version=5.1-preview.8




              the release got successfully updated.






              share|improve this answer

























                0












                0








                0







                I used "Invoke-RestMethod" powershell commandlet to get release metadata. This commandlet returns custom ps object which I then updated, converted to json using "ConvertTo-Json" commandlet and provided in the body of the PUT HTTP request to DevOps to update the release. The issue is that Powershell serialization/de-serialization process of json does not result to the original json.
                For example this json property:



                "preDeploymentGatesSnapshot": 
                "id": 0,
                "gatesOptions": null,
                "gates": []
                ,


                becomes:



                "preDeploymentGatesSnapshot": "@id=0; gatesOptions=; gates=System.Object[]"


                After I used correct json in the body of the PUT request in the API call:




                https://vsrm.dev.azure.com/organization/project/_apis/release/releases/releaseId?api-version=5.1-preview.8




                the release got successfully updated.






                share|improve this answer













                I used "Invoke-RestMethod" powershell commandlet to get release metadata. This commandlet returns custom ps object which I then updated, converted to json using "ConvertTo-Json" commandlet and provided in the body of the PUT HTTP request to DevOps to update the release. The issue is that Powershell serialization/de-serialization process of json does not result to the original json.
                For example this json property:



                "preDeploymentGatesSnapshot": 
                "id": 0,
                "gatesOptions": null,
                "gates": []
                ,


                becomes:



                "preDeploymentGatesSnapshot": "@id=0; gatesOptions=; gates=System.Object[]"


                After I used correct json in the body of the PUT request in the API call:




                https://vsrm.dev.azure.com/organization/project/_apis/release/releases/releaseId?api-version=5.1-preview.8




                the release got successfully updated.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 9 at 0:38









                ExaStepExaStep

                63




                63





























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54755547%2fazure-devops-how-to-update-release-scoped-variables-using-rest-api%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    1928 у кіно

                    Захаров Федір Захарович

                    Ель Греко