Secrets management
Secrets are handled differently depending on whether they are used by people or by applications.
We maintain a clear separation between human-accessed secrets and application secrets to reduce risk and improve auditability.
Human-accessed secrets (Vaultwarden)
Section titled “Human-accessed secrets (Vaultwarden)”Vaultwarden is used for sharing credentials between team members.
Typical examples include:
- Database credentials used during development or troubleshooting
- Service accounts accessed manually from the jumpserver
- Administrative passwords
Vaultwarden is intended for human access only.
Developers retrieve secrets manually when needed (for example while connected to the jumpserver).
Application secrets (Azure Key Vault)
Section titled “Application secrets (Azure Key Vault)”Azure Key Vault is used for secrets consumed by applications and infrastructure.
Examples include:
- Connection strings
- API keys
- Certificates
- Service credentials
Applications retrieve secrets from Key Vault at runtime using managed identities or service principals.
Secrets must not be hardcoded in source code or configuration files.
How .NET services read from Key Vault
Section titled “How .NET services read from Key Vault”.NET services use the shared library KalmarEnergi.Core.KeyVault to read secrets and certificates from Key Vault:
- In the cluster, services authenticate with a service principal (tenant ID, client ID and client secret) supplied through a secret, or with an Azure identity bound to the pod.
- Only the vault address and the names of secrets live in configuration. Secret values stay in Key Vault.
Required configuration and usage are described in Reading secrets from Key Vault.
Use Key Vault for new and existing services
Section titled “Use Key Vault for new and existing services”Every service that needs an application secret should read it from Key Vault:
- New development: store the secret in Key Vault from the start and read it through the shared library.
- Existing services: if a secret lives in
appsettings*.json, plain-text values in deployment manifests, files or source code, move it to Key Vault when you work in that area.
The service principal credentials used to reach Key Vault are the only exception, and are supplied through ConfigMaps.
Separation of responsibilities
Section titled “Separation of responsibilities”We intentionally separate secret storage based on usage:
- Vaultwarden → humans
- Azure Key Vault → applications
This separation reduces accidental leakage and makes ownership and access patterns clearer.