1

Is there any way to explicitly print the value of a variable in a pipeline step? All my attempts only display "***". Tried with Bash, Command-Line, and Powershell. Same result for everyone.

Pipeline steps

The first variable comes from the previous step. The other two are settled in the "Variables" menu.

Result

EDIT 1 ----------------

Variables definition. Not defined as Secret:

Variables definition

Where the IP Address comes from. An ARM Template:

enter image description here

fds13
  • 65
  • 8
  • Those variables are defined as secret, hence they do not appear in the logs as plain text. See this thread (which is a potential duplicate of your question) for more explanation [VSTS secrets as environment variables](https://stackoverflow.com/questions/50110315/vsts-secrets-as-environment-variables) – Yan Sklyarenko Oct 21 '21 at 05:57
  • General answer: Use $env.Variablename to find the values(not for secrets) are in the format which was sent. – Dilly B Oct 21 '21 at 07:22
  • @YanSklyarenko I did not define these variables as secret. I will edit the post with this information and check this potential duplicate also. – fds13 Oct 21 '21 at 15:27
  • @user2670623 I will try that way. – fds13 Oct 21 '21 at 15:28
  • @YanSklyarenko I look into the potential duplicate and I think that is a little different because my variables are not defined as secret. And the IP variable came from a Deployment Output. – fds13 Oct 21 '21 at 21:43

2 Answers2

1

DevOps will not output variables defined as "Secret" in the log.

You would have to go a somewhat roundabout way as described here: Get Azure Devops Secret Variable as Plain Text using Powershell

But: If you want to output the "Secrets" anyway in the log of your pipeline, then you don't need to define the variables as Secret but you can just use PlainText (simplest solution, screenshot).

Devops Library

However, I would recommend you to set up a KeyVault, store the secrets there and include a link to the secret in the log, so that the user can retrieve the access data via the link after the deployment.

Regarding the IP: If you define a variable inside the pipeline (like with the IP) you have to make sure that you don't use "issecret" for echo "##vso[task.setvariable variable=secretVariable;issecret=true] ...".

Microsoft - SetVariable: Initialize or modify the value of a variable

Sven
  • 420
  • 3
  • 10
  • I did not define these variables as Secret. I'm editing the post with this information. Regarding the IP, it comes from the previous step, from the Deployment outputs. I will put this in the post also. – fds13 Oct 21 '21 at 15:29
0

I found the "problem". I don't know why, but the third (Parse ARM Deployment Outputs into variables) step was doing this with the variables.

After removing it, the values were shown as expected.

enter image description here

fds13
  • 65
  • 8