User secrets (in Development) These are merged in order — later values override earlier ones. 🧱 2. What are configuration providers?
Configuration providers are components that load configuration data from various
sources.
Built-in Providers:
- JSON files (appsettings.json)
- Environment variables
- Command-line arguments
Follow :
- In-memory collections
- Azure Key Vault
- User Secrets (for local dev)
- Custom providers (you can build your own)
Example:
builder.Configuration
.AddJsonFile("appsettings.json")
.AddEnvironmentVariables()
.AddCommandLine(args);
Each provider plugs into the same configuration system, so you can access everything via
IConfiguration.
🔐 3. How do you manage secrets in development?
In development, never store passwords, API keys, or connection strings in code or
appsettings.json.
Use User Secrets — a safe way to store secrets outside the project tree.
🧰 4. What is User Secrets in ASP.NET Core?
User Secrets are a local, developer-only configuration storage that keeps sensitive data
out of source control.
Setup:
Enable secrets:
dotnet user-secrets init
Follow :