2
votes

I am developing web extension for VSTS. I am using vss sdk of Microsoft. I got some issue.

You can see on the image that there is new line - App insights Settings This pop up appears on clicking on 3 dots near every release definition on page of list of all releases.

enter image description here

This button navigates user to some environment of some specific release. Example of link: https://ozcodedev.visualstudio.com/OzCode/_releaseProgress?releaseId=372&_a=release-environment-logs&environmentId=850

The problem that I do not know how to fetch list of releases and environments for building this link. How can I get them on page All release pipelines. enter image description here

3

3 Answers

1
votes

Through the GUI it is not possible to get all the release ids and the environment ids for each step. However this is possible through the VSTS APIS. You could use the release endpoint to and iterate to obtain your release id

https://{accountName}.vsrm.visualstudio.com/{project}/_apis/release/releases?api-version=4.1-preview.6

Once you have the release id you can use it like so

https://{accountName}.vsrm.visualstudio.com/{project}/_apis/release/releases/{releaseId}?api-version=4.1-preview.6 

Within the returned JSON you can follow iterate the path environment[n].id to obtain the environment id.

You can then construct the link using this information.

Hope that helps

1
votes

Ok. So after working 2 days on this issue I found solution.

1.It is possible to fetch data that I wanted on Client Side. For this I used Microsoft's library vss-web-extension-sdk. Install it - npm install vss-web-extension-sd --save.

2.Add relevant scopes to your vss-extension.json. In my case the problem was - that I needed data that relates to managing of VSTS user releases. So after Including "vso.release_manage" to my scopes array I stopped to got 401 Unauthorized error because access token was changed according to new scopes.

https://docs.microsoft.com/en-us/vsts/extend/develop/manifest?view=vsts#scopes

In this documentation you can check which scope controls which resources that can be accessed by your extension.

0
votes

You can use our ts/js clients to get whatever you want for your experience.

We have extensive documentation available here. Let me know if you are blocked anywhere.