skip to Main Content

I have created the New Variable Group in Library of the Pipelines from which one variable’s value is locked and the another is not locked as you can see in below screenshot:

enter image description here

I’m trying to get/fetch these values in the pipelines:

trigger:
- main

pool:
  vmImage: ubuntu-latest

variables:
 - group: DevGroup
 - name: buildSolution
   value: '**/*.sln'
 - name: buildPlatform
   value: 'Any CPU'
 - name: 'buildConfiguration'
   value: 'Release'
 - name:  'Poornasapproval'
   value: 'yes'

steps:

- script: 
   echo -e $(buildSolution)
   echo -e $(StorageAccName)
   echo -e $(Location)

- powershell: 
   Write-Host "$(StorageAccName) is the Storage Account Name"

- powershell: |
    "the value: $(StorageAccName)" | Out-File -FilePath  $(Build.ArtifactStagingDirectory)DisplaySecret.txt
- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: '$(Build.ArtifactStagingDirectory)'
    ArtifactName: 'drop'
    publishLocation: 'Container'

I have written two PowerShell scripts in which one can print the secret value to logs (command line) and to the text file.

To the text file, it is showing the value but in the logs, it is not showing the value.

It is showing asterisk symbols.

enter image description here

In the Text File:

enter image description here

Here the question is:

How do I can see the Variables value from the Logs or Azure DevOps UI or in the Pipelines if the value is secured/locked/protected.

Note: I’m the administrator of the organization, project, repository, pipelines.

2

Answers


  1. If a variable’s value is secured/locked/protected, you may not be able to view its value directly from the logs or Azure DevOps UI. However, you can still access the variable’s value within your pipeline by using the appropriate syntax.

    Login or Signup to reply.
  2. It is the whole point of secret variables that they are not visible in the pipeline or the logs, as explained in the Microsoft Documentation.

    Secret variables can be used for private information like passwords, IDs, and other identifying data that you wouldn’t want to have exposed in a pipeline.

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