Managing App Settings made easy with Azure App Configuration

Distributed and micro-services based applications runs on multiple virtual machines or containers. Managing all the configuration settings for the services and components in such systems is a challenge. Spreading configuration settings across these components can lead to hard-to-troubleshoot errors during an application deployment.

Azure App Configuration helps to store all these settings for application centrally and provide secure access. These settings are stored as Key-Value an making a change to one key value cane be updated to all the applications using the setting. App Configuration also provides encryption in transit and at rest, and point-in-time snapshots so to help in comparing settings over time, or rollback settings after a failed deployment.

Create an app configuration store

To create an app configuration, login to the Azure portal.  Search and Select App Configuration from the search results, and then select Create.


Click, Add button on the top, fill the required details in the new blade and click Create.


Once your App configuration resource is ready, you’ll find primary and secondary connection strings in Access Keys, like you would in a storage account. You may use “Readonly” Keys for the application to have only read access.


You can use the Key-Value Explorer to begin adding settings into the configuration store.


You can also tag a setting, lock a setting, and look at the history of changes for a setting as below.


The History shows all the changes made to the config key along with the date and time of the change.


Moreover, you can compare settings with different labels (for eg: Prod vs Staging or Prod vs DR) to view differences.


Using App Configuration in .Net Console Application

1. Right-click your project, and select Manage NuGet Packages. On the Browse tab, search and add the following NuGet packages to your project. If you can’t find them, select the Include prerelease check box.

Microsoft.Configuration.ConfigurationBuilders.AzureAppConfiguration 1.0.0 preview or later

Microsoft.Configuration.ConfigurationBuilders.Environment 2.0.0 preview or later

2. Update the App.config file of project as below:

<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 = ConfigurationManager.AppSettings[“TestApp:Settings:Message”];


Also Read Import and export configuration in Azure App Configuration Store


1 comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: