In this article, we are going to learn about a technique using which you can view the value of the secret variable created inside a Variable Group of Azure DevOps.
Introduction
Azure DevOps supports us to store secrets within Azure DevOps – Var Groups which could be used with the Pipelines. These secret variables couldn’t be viewed by us manually from the portal. Sometimes, we may want to view the password to perform some administrative activity.
In this article, we are going to learn how to create a pipeline that publishes the secret variable created in the Azure DevOps Variable Group.
Variable Groups – Secret variable
Let’s create a Secret variable in a Variable Group as shown below and make sure that you set it as a secret by locking it (#3 below).

Once you mark it a secret, save the Var Group, no one including you will be able to view the secret. Let’s now understand how to view the secret with the help of Azure DevOps – Pipelines.
Azure Pipelines – View Secrets
Let’s create a simple Pipeline which has the below tasks in it.
- PowerShell task which outputs a text (along with secret) into a file names DisplaySecret.Txt
- Publish the DisplaySecret.txt into Azure Pipeline artifacts.
Let’s add the below script to the Azure DevOps – YAML Pipeline
variables:
- group: Tips
steps:
- powershell: |
"the value: $(Secret)" | Out-File -FilePath $(Build.ArtifactStagingDirectory)\DisplaySecret.txt
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
Let’s now run the Pipeline which publish an artifact as shown below.

Now, click on the DisplaySecret.txt file to download the file. Once you download it, view that in a Notepad which should like this.

That how you can view the secrets.
Summary
In this article, we have learnt how to view the secret value of a secret variable created within the Variable Group.
Do you like this article? If you want to get more updates about these kind of articles, you can join my Learning Groups