-
Notifications
You must be signed in to change notification settings - Fork 0
Adding a Secret
Osotechie edited this page Jun 22, 2026
·
1 revision
How to add a new secret for use in container configuration.
🔗 For the full secrets architecture (KeyVault design, SPN setup, naming conventions), see Secrets & Credentials in the nas-as-code wiki.
az keyvault secret set \
--vault-name <your-vault-name> \
--name "myapp-api-key" \
--value "the-actual-secret-value"In your stack's .env file, add:
MYAPP_API_KEY=#{MYAPP_API_KEY}#environment:
- API_KEY=${MYAPP_API_KEY}The .env file (with the token, not the secret) gets committed. The workflow replaces #{MYAPP_API_KEY}# with the real value at deploy time.
| KeyVault Name | Environment Variable | Token in .env
|
|---|---|---|
myapp-api-key |
MYAPP_API_KEY |
#{MYAPP_API_KEY}# |
plex-token |
PLEX_TOKEN |
#{PLEX_TOKEN}# |
sonarr-api-key |
SONARR_API_KEY |
#{SONARR_API_KEY}# |
Rule: KeyVault uses lowercase-with-hyphens → workflow converts to UPPERCASE_WITH_UNDERSCORES.
-
Never commit actual secret values — only the
#{TOKEN}#pattern - No workflow changes needed — the pipeline dynamically pulls ALL secrets from KeyVault
- Shared across repos — the same KeyVault serves both nas-as-code and this repo
- Rotation — just update the value in KeyVault; next deploy picks it up automatically
Overview
How-To