Leveraging built-in configuration providers
There are multiple configuration sources available other than appsettings.json
, and .NET 5 provides several built-in configuration providers to read from them. The following are built-in providers available for .NET 5:
- The Azure Key Vault configuration provider reads configurations from Azure Key Vault.
- The file configuration provider reads configurations from INI, JSON, and XML files.
- The command-line configuration provider reads configuration from command-line parameters.
- The environment variable configuration provider reads configurations from environment variables.
- The memory configuration provider reads configurations from in-memory collections.
- Azure App Configuration provider to read configuration from Azure App configuration.
- The key-per-file configuration provider reads configurations from a directory's files.
Let's see how we can leverage the Azure Key Vault configuration provider...