Secret

noun

say it: “SEE-krit” /ˈsikrɪt/

A password, token or key that opens a door, which a script should read from outside instead of keeping in its own text.

What is a secret in a PowerShell script?

A secret is anything that lets its holder in: a password, an API key, a deploy token. Written into a script, it travels wherever the script goes, into Git's history, an email or a shared screen. So a script reads it from an environment variable, a sign-in prompt or a vault, and says that it found it, never what it is.

if (-not $env:BIKESHOP_DEPLOY_TOKEN) {
    throw 'Set $env:BIKESHOP_DEPLOY_TOKEN first.'
}

In a sentence

  • “Never print a secret: say that it was found, not what it is.”
  • “The deploy token is a secret, so build.ps1 reads it from an environment variable.”

Level: Journeyman · More PowerShell terms at this level

Updated