Search code examples
powershellappveyorsecurestring

Secure Appveyor variables in PowerShell


How to use a secure variable in a PowerShell command?

Example:

environment:
  password:
    secure: HEa8MAJyyfSv33snyK3Gleflk9SIfZBxbnTiS39hlWM=

install:
- ps: $env:password

Nothing is printed by this command. According to this page this is the way to use environment variables in PowerShell but apparently the secure Appveyor variable is not there.


Solution

  • I found the culprit:

    From the Appveyor webpage about secure variables:

    secure variables are not decoded during Pull Request

    That was exactly what I was trying to do.

    As mentioned in the comments, secure variables can be activated in the Appveyor project settings and everything works as intended.