question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to use Secret variables in Override Template Parameters

See original GitHub issue

I have some variables that are being created using Write-Verbose (“##vso[task.setvariable variable=$VariableName;issecret=true;]$VariableValue”). I then want to use these variables as parameters for an Azure deployment template using the Override Template Parameters section in the Azure Resource Group Deployment vsts task. I am expecting the parameter to be set to the value of $VariableValue. The actual value that I’m getting is ‘********’. If the variable is not set as secret, it works as expected.

Thanks in advance for any assistance I can get with this issue.

UPDATE After some investigation I have some updates for this issue.

Problem: The actual root of the problem was the use of (ConvertTo-SecureString '$(VariableValue)' -AsPlainText -Force). When calling this with a hidden vsts variable it uses ******** instead of the correct value of the variable. I have also confirmed that this is the case for other tasks, not just in the Override Template Parameters section in the Azure Resource Group Deployment task.

Workaround: Instead of making these vsts variables secret, I am instead encrypting the strings and storing them as plain text values which can later be used to get a secure string with (ConvertTo-SecureString -string '$(EncryptedValue)') To do this for variables that you have defined in vsts you need to have a script that takes the hidden variable, does the conversion and then set the variable again, this time as plain text, with the encrypted string with the encrypted string.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
AinslieCleverdoncommented, Jun 19, 2017

I am aware that secrets are masked in the logs. What I am experiencing is the actual values being used are ********. e.g. I have a password for an sql server admin in a secret vsts variable I get the following error:

"code": "40632"
"message": "Password validation failed. The password does not meet policy requirements because it is not complex enough."

This is because it is using ******** as the value for the password, it’s not just being masked in the log. As I stated in my original post, if the variable is not marked as secret, the deployment works as expected and uses the intended values.

0reactions
hiyadavcommented, Jul 25, 2017

@AinslieCleverdon Closing the issue now, if you still face some problem, do let us know.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to use Secret variables in Override Template Parameters
I have some variables that are being created using Write-Verbose ("##vso[task.setvariable variable=$VariableName;issecret=true ...
Read more >
Unable to override template parameters in Automated ...
By the error message, It seems the main root is not set correctly. You have set '$(System.DefaultWorkingDirectory)/_ADF_PoC/ArmTemplates/ARMTemplateForFactory.
Read more >
I am getting an error called Either Value or Key vault must be ...
I have created Variable group and then came back to release pipeline arm job then in the override parameter . Arm job over...
Read more >
Azure DevOps YAML Templates: What I've Learned & Best ...
It's a good thing that Azure Devops supports Secrets out-of-the-box in Variable Groups. Here are some lacking features: You can't view a Secret...
Read more >
Environment variables to configure the AWS CLI
You can override this environment variable by using the --output command line parameter. AWS_DEFAULT_REGION. Specifies the AWS Region to send the request to....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found