skip to Main Content

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


  1. 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).

    Login or Signup to reply.
  2. I tried using print value, but it does not work.

    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.

    pool:
      vmImage: ubuntu-latest
    variables:
    - group: "variable group name"
    steps:
    - script: |
          echo $(secret)
          string=$(secret)
          for (( i=0; i<${#string}; i++ )); do
            echo "${string:$i:1}"
          done
      displayName: 'print the secret'
    

    The log:

    enter image description here

    Please be careful not to use this method under normal circumstances, as it may cause secrets to be leaked.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search