Quickstart: Create a .NET Framework app with Azure App Configuration

There are two ways to incorporate Azure App Configuration into a .NET Framework-based app.

  • 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.
  • 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 or an ASP.NET web app.

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.


Create an App Configuration store

  1. To create a new App Configuration store, sign in to the Azure portal.

  2. In the upper-left corner of the home page, select Create a resource.

  3. In the Search services and marketplace box, enter App Configuration and select Enter.

    Screenshot that shows the Search for App Configuration page.

  4. Select App Configuration from the search results, and then select Create.

    Screenshot that shows the Create page.

  5. On the Create App Configuration pane, enter the following settings:

    Setting Suggested value Description
    Subscription Your subscription Select the Azure subscription that you want to use to test App Configuration. If your account has only one subscription, it's automatically selected and the Subscription list isn't displayed.
    Resource group AppConfigTestResources Select or create a resource group for your App Configuration store resource. This group is useful for organizing multiple resources that you might want to delete at the same time by deleting the resource group. For more information, see Use resource groups to manage your Azure resources.
    Resource name Globally unique name Enter a unique resource name to use for the App Configuration store resource. The name must be a string between 5 and 50 characters and contain only numbers, letters, and the - character. The name can't start or end with the - character.
    Location Central US Use Location to specify the geographic location in which your app configuration store is hosted. For the best performance, create the resource in the same region as other components of your application.
    Pricing tier Free Select the desired pricing tier. For more information, see the App Configuration pricing page.
  6. Select Review + create to validate your settings.

  7. Select Create. The deployment might take a few minutes.

  8. After the deployment finishes, go to the App Configuration resource. Select Settings > Access keys. Make a note of the primary read-only key connection string. You'll use this connection string later to configure your application to communicate with the App Configuration store that you created.

  1. Select Configuration explorer > + Create > Key-value to add the following key-value:

    Key Value
    TestApp:Settings:Message Data from Azure App Configuration

    Leave Label and Content Type empty.

Create a .NET Framework console app

  1. Start Visual Studio and select Create a new project.

  2. In Create a new project, filter on the Console project type and select Console App (.NET Framework) with C# from the project template list. Press Next.

  3. In Configure your new project, enter a project name. Under Framework, select .NET Framework 4.7.2 or higher. Press Create.

Connect to an App Configuration store

  1. Right-click your project, and select Manage NuGet Packages. On the Browse tab, search and add the following NuGet packages to your project.

    • Microsoft.Configuration.ConfigurationBuilders.AzureAppConfiguration version 1.0.0 or later
    • Microsoft.Configuration.ConfigurationBuilders.Environment version 2.0.0 or later
    • System.Configuration.ConfigurationManager version 4.6.0 or later
  2. Update the App.config file of your project as follows:

        <section name="configBuilders" type="System.Configuration.ConfigurationBuildersSection, System.Configuration, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" restartOnExternalChanges="false" requirePermission="false" />
            <add name="MyConfigStore" mode="Greedy" connectionString="${ConnectionString}" type="Microsoft.Configuration.ConfigurationBuilders.AzureAppConfigurationBuilder, Microsoft.Configuration.ConfigurationBuilders.AzureAppConfiguration" />
            <add name="Environment" mode="Greedy" type="Microsoft.Configuration.ConfigurationBuilders.EnvironmentConfigBuilder, Microsoft.Configuration.ConfigurationBuilders.Environment" />
    <appSettings configBuilders="Environment,MyConfigStore">
        <add key="AppName" value="Console App Demo" />
        <add key="ConnectionString" value ="Set via an environment variable - for example, dev, test, staging, or production connection string." />

    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.

  3. Open Program.cs, and update the Main method to use App Configuration by calling ConfigurationManager.

    static void Main(string[] args)
        string message = System.Configuration.ConfigurationManager.AppSettings["TestApp:Settings:Message"];

Build and run the app

  1. Set an environment variable named ConnectionString to the read-only key connection string obtained during your App Configuration store creation.

    If you use the Windows command prompt, run the following command:

    setx ConnectionString "connection-string-of-your-app-configuration-store"

    If you use Windows PowerShell, run the following command:

    $Env:ConnectionString = "connection-string-of-your-app-configuration-store"
  2. Restart Visual Studio to allow the change to take effect.

  3. Press Ctrl + F5 to build and run the console app. You should see the message from App Configuration outputs in the console.

Clean up resources

If you don't want to continue using the resources created in this article, delete the resource group you created here to avoid charges.


Deleting a resource group is irreversible. The resource group and all the resources in it are permanently deleted. Ensure that you don't accidentally delete the wrong resource group or resources. If you created the resources for this article inside a resource group that contains other resources you want to keep, delete each resource individually from its respective pane instead of deleting the resource group.

  1. Sign in to the Azure portal, and select Resource groups.
  2. In the Filter by name box, enter the name of your resource group.
  3. In the result list, select the resource group name to see an overview.
  4. Select Delete resource group.
  5. You're asked to confirm the deletion of the resource group. Enter the name of your resource group to confirm, and select Delete.

After a few moments, the resource group and all its resources are deleted.

Next steps

In this quickstart, you created a new App Configuration store and used it with a .NET Framework console app. To learn how to enable your .NET Framework app to dynamically refresh configuration settings, continue to the next tutorials.