I need to set a secret variable in my Azure DevOps library group using pipelines and/or PowerShell? Is this possible? On premise installation of Azure DevOps Server.
I need to set a secret variable in my Azure DevOps library group using pipelines and/or PowerShell? Is this possible? On premise installation of Azure DevOps Server.
2
Answers
You can use the open source VSTeam powershell module or the official az cli extension to achieve what you want.
You can set variables via api requests. I have done a similar setup to upload secure files, which is discussed here. Copying my solution from that thread:
You should be able to do pretty much the same, but alter the uri to target the libraries instead. See Microsoft documentation about updating variables in a library here. Basically, call
PUT https://dev.azure.com/{organization}/_apis/distributedtask/variablegroups/{groupId}?api-version=7.0
and set the body to match the variables you want to update.