You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#Customer intent: As a .NET Framework developer, I want to manage all my app settings in one place.
13
13
---
14
14
# Quickstart: Create a .NET Framework app with Azure App Configuration
15
15
16
16
There are two ways to incorporate Azure App Configuration into a .NET Framework-based app.
17
17
18
-
- The configuration builder for App Configuration enables data from App Configuration to be loaded to App Settings. Your app accesses configuration as it always does via `ConfigurationManager`. You don't need to make any code change other than updates to *app.config* or *web.config* files. This quickstart will walk you through this option.
19
-
- As is designed by the .NET Framework, the App Settings can only refresh upon application restart. The App Configuration .NET provider is a .NET Standard library. It supports caching and refreshing configuration dynamically without application restart. If the dynamic configuration is essential to you and you are willing to make code changes, see tutorials on how you can implement dynamic configuration updates in a [.NET Framework console app](./enable-dynamic-configuration-dotnet.md) or an [ASP.NET web app](./enable-dynamic-configuration-aspnet-netfx.md).
18
+
- The configuration builder for App Configuration enables data from App Configuration to be loaded to App Settings. Your app accesses configuration as it always does via `ConfigurationManager`. You don't need to make any code change other than updates to *app.config* or *web.config* files. This quickstart walks you through this option.
19
+
- As is designed by the .NET Framework, the App Settings can only refresh upon application restart. The App Configuration .NET provider is a .NET Standard library. It supports caching and refreshing configuration dynamically without application restart. If the dynamic configuration is essential to you and you're willing to make code changes, see tutorials on how you can implement dynamic configuration updates in a [.NET Framework console app](./enable-dynamic-configuration-dotnet.md) or an [ASP.NET web app](./enable-dynamic-configuration-aspnet-netfx.md).
20
20
21
21
In this quickstart, a .NET Framework console app is used as an example, but the same technique applies to an ASP.NET Web Forms/MVC app.
22
22
@@ -45,33 +45,63 @@ Add the following key-value to the App Configuration store and leave **Label** a
45
45
46
46
## Connect to an App Configuration store
47
47
48
-
1. Right-click your project, and select **Manage NuGet Packages**. On the **Browse** tab, search and add the following NuGet packages to your project.
48
+
Connect to your App Configuration store using Microsoft Entra ID (recommended), or a connection string.
49
49
50
-
-*Microsoft.Configuration.ConfigurationBuilders.AzureAppConfiguration* version 1.0.0 or later
51
-
-*Microsoft.Configuration.ConfigurationBuilders.Environment* version 2.0.0 or later
52
-
-*System.Configuration.ConfigurationManager* version 4.6.0 or later
50
+
1. Right-click your project, and select **Manage NuGet Packages**. On the **Browse** tab, search and add the latest stable versions of following NuGet packages to your project.
53
51
54
-
1. Update the *App.config* file of your project as follows:
1. Update the *App.config* file of your project as follows. You can connect to your App Configuration store using Microsoft Entra ID (recommended), or a connection string.
57
+
58
+
### [Microsoft Entra ID (recommended)](#tab/entra-id)
59
+
60
+
The `DefaultAzureCredential` is used to authenticate to your App Configuration store by default. Follow the [instructions](./concept-enable-rbac.md#authentication-with-token-credentials) to assign your credential the **App Configuration Data Reader** role. Be sure to allow sufficient time for the permission to propagate before running your application.
<addkey="Endpoint" value ="Set via an environment variable - for example, dev, test, staging, or production endpoint." />
77
+
</appSettings>
78
+
```
79
+
80
+
The endpoint value of your App Configuration store is read from the environment variable `Endpoint`. You also add the `Environment` configuration builder before the `MyConfigStore` in the `configBuilders` property of the `appSettings` section.
<addkey="ConnectionString" value ="Set via an environment variable - for example, dev, test, staging, or production connection string." />
71
99
</appSettings>
72
100
```
73
-
74
-
The connection string of your App Configuration store is read from the environment variable `ConnectionString`. Add the `Environment` configuration builder before the `MyConfigStore` in the `configBuilders` property of the `appSettings` section.
101
+
102
+
The connection string of your App Configuration store is read from the environment variable `ConnectionString`. You also add the `Environment` configuration builder before the `MyConfigStore` in the `configBuilders` property of the `appSettings` section.
103
+
104
+
---
75
105
76
106
1. Open *Program.cs*, and update the `Main` method to use App Configuration by calling `ConfigurationManager`.
77
107
@@ -87,7 +117,33 @@ Add the following key-value to the App Configuration store and leave **Label** a
87
117
88
118
## Build and run the app
89
119
90
-
1. Set an environment variable named **ConnectionString** to the read-only key connection string obtained during your App Configuration store creation.
120
+
1. Set an environment variable.
121
+
122
+
### [Microsoft Entra ID (recommended)](#tab/entra-id)
123
+
124
+
Set an environment variable named **Endpoint** to the endpoint of your App Configuration store found under the **Overview** of your store in the Azure portal.
125
+
126
+
If you use the Windows command prompt, run the following command and restart the command prompt to allow the change to take effect:
Set an environment variable named **ConnectionString** to the read-only connection string of your App Configuration store found under **Access settings** of your store in the Azure portal.
91
147
92
148
If you use the Windows command prompt, run the following command:
93
149
@@ -101,6 +157,13 @@ Add the following key-value to the App Configuration store and leave **Label** a
0 commit comments