Secret using environment variables and ps1/powershell

Beside Azure Key Vault, there is also an option to use environment variables to store, API keys, access tokens, and database credentials.

  • No hard-coding secrets directly into the code for application
  • Env variables can be accessed by application
  • No configuration change for application on files
  • The secrets remain separate from the source codebase
  • The secret can be managed and modified as needed without the risk of exposing them

Go to system

Add a new system variable

Access the environment variable

$env:varname

Scroll to Top