Skip to content

Commit 89b3777

Browse files
committed
Replace connection string with endpoint
1 parent 9e0521c commit 89b3777

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

articles/azure-app-configuration/howto-labels-aspnet-core.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ ms.devlang: csharp
77
author: maud-lv
88
ms.topic: conceptual
99
ms.custom: devx-track-csharp
10-
ms.date: 02/20/2024
10+
ms.date: 03/19/2025
1111
ms.author: malev
1212

1313
---
1414
# Use labels to provide per-environment configuration values.
1515

16-
Many applications need to use different configurations for different environments. Suppose that an application has a configuration value that defines the connection string to use for its back-end database. The application developers use a different database from the one used in production. The database connection string that the application uses must change as the application moves from development to production.
16+
Many applications need to use different configurations for different environments. Suppose that an application has a configuration value that defines the endpoint to use for its back-end database. The application developers use a different database from the one used in production. The database endpoint that the application uses must change as the application moves from development to production.
1717

1818
In Azure App Configuration, you can use *labels* to define different values for the same key. For example, you can define a single key with different values for development and production. You can specify which label to load when connecting to App Configuration.
1919

@@ -47,7 +47,7 @@ var builder = WebApplication.CreateBuilder(args);
4747

4848
builder.Configuration.AddAzureAppConfiguration(options =>
4949
{
50-
options.Connect(builder.Configuration.GetConnectionString("AppConfig"))
50+
options.Connect(builder.Configuration.GetValue<string>("Endpoints:AppConfiguration"))
5151
// Load configuration values with no label
5252
.Select(KeyFilter.Any, LabelFilter.Null)
5353
// Override with any configuration values specific to current hosting env
@@ -56,7 +56,7 @@ builder.Configuration.AddAzureAppConfiguration(options =>
5656
```
5757

5858
> [!IMPORTANT]
59-
> The preceding code snippet uses the Secret Manager tool to load App Configuration connection string. For information storing the connection string using the Secret Manager, see [Quickstart for Azure App Configuration with ASP.NET Core](quickstart-aspnet-core-app.md).
59+
> The preceding code snippet uses the Secret Manager tool to load App Configuration endpoint. For information storing the endpoint using the Secret Manager, see [Quickstart for Azure App Configuration with ASP.NET Core](quickstart-aspnet-core-app.md).
6060
6161
The `Select` method is called twice. The first time, it loads configuration values with no label. Then, it loads configuration values with the label corresponding to the current environment. These environment-specific values override any corresponding values with no label. You don't need to define environment-specific values for every key. If a key doesn't have a value with a label corresponding to the current environment, it uses the value with no label.
6262

0 commit comments

Comments
 (0)