Skip to content

Commit d93c447

Browse files
svickCopilot
andauthored
Document new EnvironmentVariablesConfigurationProvider connection string prefixes (.NET 10) (#37062)
* Document new EnvironmentVariablesConfigurationProvider connection string prefixes Starting in .NET 10, EnvironmentVariablesConfigurationProvider recognizes seven additional connection string prefixes (POSTGRESQLCONNSTR_, APIHUBCONNSTR_, DOCDBCONNSTR_, EVENTHUBCONNSTR_, NOTIFICATIONHUBCONNSTR_, REDISCACHECONNSTR_, SERVICEBUSCONNSTR_) added by dotnet/runtime#116037. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Applied suggestions from review --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 1439c1a commit d93c447

1 file changed

Lines changed: 43 additions & 2 deletions

File tree

  • aspnetcore/fundamentals/configuration

aspnetcore/fundamentals/configuration/index.md

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ description: Learn how to use the Configuration API to configure app settings in
66
monikerRange: '>= aspnetcore-3.1'
77
ms.author: tdykstra
88
ms.custom: mvc
9-
ms.date: 02/11/2026
9+
ms.date: 04/28/2026
1010
uid: fundamentals/configuration/index
1111
---
1212
# Configuration in ASP.NET Core
@@ -641,7 +641,9 @@ For [Azure App Service](https://azure.microsoft.com/services/app-service/) app s
641641

642642
### Connection string prefixes
643643

644-
The Configuration API has special processing rules for four connection string environment variables. These connection strings are involved in configuring Azure connection strings for the app environment. Environment variables with the prefixes shown in the following table are loaded into the app with the [default configuration](#default-app-configuration-sources) or when no prefix is supplied to <xref:Microsoft.Extensions.Configuration.EnvironmentVariablesExtensions.AddEnvironmentVariables%2A>.
644+
The Configuration API has special processing rules for connection string environment variables. These connection strings are involved in configuring Azure connection strings for the app environment. Environment variables with the prefixes shown in the following table are loaded into the app with the [default configuration](#default-app-configuration-sources) or when no prefix is supplied to <xref:Microsoft.Extensions.Configuration.EnvironmentVariablesExtensions.AddEnvironmentVariables%2A>.
645+
646+
:::moniker range="< aspnetcore-10.0"
645647

646648
Connection string prefix | Provider
647649
--- | ---
@@ -662,6 +664,45 @@ Environment variable key | Converted configuration key | Provider configuration
662664
`SQLAZURECONNSTR_{KEY}` | `ConnectionStrings:{KEY}` | Key: `ConnectionStrings:{KEY}_ProviderName`:<br>Value: `System.Data.SqlClient`
663665
`SQLCONNSTR_{KEY}` | `ConnectionStrings:{KEY}` | Key: `ConnectionStrings:{KEY}_ProviderName`:<br>Value: `System.Data.SqlClient`
664666

667+
:::moniker-end
668+
669+
:::moniker range=">= aspnetcore-10.0"
670+
671+
Connection string prefix | Provider
672+
--- | ---
673+
`APIHUBCONNSTR_` | Azure API hubs
674+
`CUSTOMCONNSTR_` | Custom provider
675+
`DOCDBCONNSTR_` | [Azure Cosmos DB](https://azure.microsoft.com/services/cosmos-db/)
676+
`EVENTHUBCONNSTR_` | [Azure Event Hubs](https://azure.microsoft.com/services/event-hubs/)
677+
`MYSQLCONNSTR_` | [MySQL](https://www.mysql.com/)
678+
`NOTIFICATIONHUBCONNSTR_` | [Azure Notification Hubs](https://azure.microsoft.com/services/notification-hubs/)
679+
`POSTGRESQLCONNSTR_` | [PostgreSQL](https://www.postgresql.org/)
680+
`REDISCACHECONNSTR_` | [Azure Cache for Redis](https://azure.microsoft.com/services/cache/)
681+
`SERVICEBUSCONNSTR_` | [Azure Service Bus](https://azure.microsoft.com/services/service-bus/)
682+
`SQLAZURECONNSTR_` | [Azure SQL Database](https://azure.microsoft.com/services/sql-database/)
683+
`SQLCONNSTR_` | [SQL Server](https://www.microsoft.com/sql-server/)
684+
685+
When an environment variable is discovered and loaded into configuration with any of the recognized prefixes:
686+
687+
* The configuration key is created by removing the environment variable prefix and adding a configuration key section (`ConnectionStrings`).
688+
* A new configuration key-value pair is created that represents the database connection provider when a provider name is associated with the prefix.
689+
690+
Environment variable key | Converted configuration key | Provider configuration entry
691+
--- | --- | ---
692+
`APIHUBCONNSTR_{KEY}` | `ConnectionStrings:{KEY}` | Configuration entry not created.
693+
`CUSTOMCONNSTR_{KEY}` | `ConnectionStrings:{KEY}` | Configuration entry not created.
694+
`DOCDBCONNSTR_{KEY}` | `ConnectionStrings:{KEY}` | Configuration entry not created.
695+
`EVENTHUBCONNSTR_{KEY}` | `ConnectionStrings:{KEY}` | Configuration entry not created.
696+
`MYSQLCONNSTR_{KEY}` | `ConnectionStrings:{KEY}` | Key: `ConnectionStrings:{KEY}_ProviderName`:<br>Value: `MySql.Data.MySqlClient`
697+
`NOTIFICATIONHUBCONNSTR_{KEY}` | `ConnectionStrings:{KEY}` | Configuration entry not created.
698+
`POSTGRESQLCONNSTR_{KEY}` | `ConnectionStrings:{KEY}` | Key: `ConnectionStrings:{KEY}_ProviderName`:<br>Value: `Npgsql`
699+
`REDISCACHECONNSTR_{KEY}` | `ConnectionStrings:{KEY}` | Configuration entry not created.
700+
`SERVICEBUSCONNSTR_{KEY}` | `ConnectionStrings:{KEY}` | Configuration entry not created.
701+
`SQLAZURECONNSTR_{KEY}` | `ConnectionStrings:{KEY}` | Key: `ConnectionStrings:{KEY}_ProviderName`:<br>Value: `System.Data.SqlClient`
702+
`SQLCONNSTR_{KEY}` | `ConnectionStrings:{KEY}` | Key: `ConnectionStrings:{KEY}_ProviderName`:<br>Value: `System.Data.SqlClient`
703+
704+
:::moniker-end
705+
665706
## Command-line
666707

667708
Using the [default configuration sources](#default-app-configuration-sources), the <xref:Microsoft.Extensions.Configuration.CommandLine.CommandLineConfigurationProvider> loads configuration from command-line argument key-value pairs after the following configuration sources:

0 commit comments

Comments
 (0)