Skip to content
This repository has been archived by the owner on Oct 4, 2021. It is now read-only.

How to change variable in a variable group #299

Open
PatrickGrub opened this issue Oct 26, 2020 · 2 comments
Open

How to change variable in a variable group #299

PatrickGrub opened this issue Oct 26, 2020 · 2 comments

Comments

@PatrickGrub
Copy link

I want to change via C# in Azure Devops in a specific Variable Group a specific variable:
https://docs.microsoft.com/en-us/rest/api/azure/devops/distributedtask/variablegroups?view=azure-devops-rest-5.0

How can I get started? Which VssHttpClientBase do I need? Examples?

@ydbendasan
Copy link

You'll need to install Microsoft.TeamFoundation.DistributedTask.WebApi nuget package,
reference Microsoft.TeamFoundation.DistributedTask.WebApi

then you can initialise TaskAgentHttpClient

var devopsConnection = new VssConnection(new Uri(devopsUrl), new VssBasicCredential(string.Empty, devopsToken));
var taskClient = devopsConnection.GetClient<TaskAgentHttpClient>();
var variableGroups = taskClient.GetVariableGroupsAsync(project.Id).Result;

then use methods on these to modify as you desire.

@DavidBergeron-eng
Copy link

Not impersonating didn't know.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants