Reputation: 55
I have accidentally deleted a secret variable value in my release pipeline. same variable and value is configured in another release pipeline of same project.
I wanted to know is there any way through rest api I can get the secret variable value.
Upvotes: 0
Views: 6223
Reputation: 33
In a method similar to Kevin Lu's mentioned above, but a bit simpler, you can:
Upvotes: 1
Reputation: 35574
I wanted to know is there any way through rest api I can get the secret variable value.
I am afraid that there is no such method can get the Secret Variable via Rest API.
Secret variables cannot be displayed directly in the pipeline.
But you can display specific values by outputting it to a file.
Here is an example: You can add PowerShell task to output the value to txt file, then you can use logging commnad to publish the file in Release Pipeline.
$env:test1 | Out-File $(System.DefaultWorkingDirectory)\debug.txt
Write-host "##vso[task.uploadfile]$(System.DefaultWorkingDirectory)\debug.txt"
Then you can download the txt file with the Release Logs. The value of the secret variable is in the txt file.
Upvotes: 3
Reputation: 40929
There is no way to fetch this secret. However if you have this in past releases you can modify your release
as it takes snapsot of your data. However, you should find a safe way of exposing this just to you. If you print it just to logs it will be masked. You may try to use azure cli te set variable in some variable group via this command
az pipelines variable-group variable update
[Here](Azure DevOps CLI in Azure Pipeline YAML) you have docs about running azure cli from yaml but it should be easy to move it to classic releases.
Upvotes: 0