I want make use same Locked library variables value in another project, Since the person entered in first place is not available now.
I tried using print value, but it does not work
if anyone have idea How to view the library variables value which are protected or locked in azure devops ?
Please help me
2
Answers
You cannot get the values of variables set as secret in a variable group – at least not directly.
There’s a good reason for that: secret variables can be used for private information like passwords, IDs, and other identifying data that you wouldn’t want exposed in a pipeline.
Recommended approach
If your Azure DevOps organization is linked to an Azure subscription, consider storing your secrets in an Azure key vault and link it to a variable group, instead of storing secrets directly in the variable group.
This allows you to access the secret values – e.g. for troubleshooting purposes, etc.
Also, Azure Key Vault provides among other things: auditability;
secret rotation; centralized management; monitoring and alerting (e.g.,
using Azure Event Grid and Logic Apps to send notifications when secrets are expiring).
In the log, the secret will show as *** to protect the secret.
As a workaround, we can iterate over each character in the secret and print it line by line using the
echo
command. This way the secret will not show as ***.For example, I have a secret and the value is 123456. With the following yaml, it will print the value in log line by line.
The log:
Please be careful not to use this method under normal circumstances, as it may cause secrets to be leaked.