External Configuration Store pattern - Azure Architecture Center (2024)

Move configuration information out of the application deployment package to a centralized location. This can provide opportunities for easier management and control of configuration data, and for sharing configuration data across applications and application instances.

Context and problem

The majority of application runtime environments include configuration information that's held in files deployed with the application. In some cases, it's possible to edit these files to change the application behavior after it's been deployed. However, changes to the configuration require the application be redeployed, often resulting in unacceptable downtime and other administrative overhead.

Local configuration files also limit the configuration to a single application, but sometimes it would be useful to share configuration settings across multiple applications. Examples include database connection strings, UI theme information, or the URLs of queues and storage used by a related set of applications.

It's challenging to manage changes to local configurations across multiple running instances of the application, especially in a cloud-hosted scenario. It can result in instances using different configuration settings while the update is being deployed.

In addition, updates to applications and components might require changes to configuration schemas. Many configuration systems don't support different versions of configuration information.

Solution

Store the configuration information in external storage, and provide an interface that can be used to quickly and efficiently read and update configuration settings. The type of external store depends on the hosting and runtime environment of the application. In a cloud-hosted scenario it's typically a cloud-based storage service or dedicated configuration service, but could be a hosted database or other custom system.

The backing store you choose for configuration information should have an interface that provides consistent and easy-to-use access. It should expose the information in a correctly typed and structured format. The implementation might also need to authorize users' access in order to protect configuration data, and be flexible enough to allow storage of multiple versions of the configuration (such as development, staging, or production, including multiple release versions of each one).

Many built-in configuration systems read the data when the application starts up, and cache the data in memory to provide fast access and minimize the impact on application performance. Depending on the type of backing store used, and the latency of this store, it might be helpful to implement a caching mechanism within the external configuration store. For more information, see the Caching Guidance. The figure illustrates an overview of the External Configuration Store pattern with optional local cache.

External Configuration Store pattern - Azure Architecture Center (1)

Issues and considerations

Consider the following points when deciding how to implement this pattern:

Choose a backing store that offers acceptable performance, high availability, robustness, and can be backed up as part of the application maintenance and administration process. In a cloud-hosted application, using a cloud storage mechanism or dedicated configuration platform service is usually a good choice to meet these requirements.

Design the schema of the backing store to allow flexibility in the types of information it can hold. Ensure that it provides for all configuration requirements such as typed data, collections of settings, multiple versions of settings, and any other features that the applications using it require. The schema should be easy to extend to support additional settings as requirements change.

Consider the physical capabilities of the backing store, how it relates to the way configuration information is stored, and the effects on performance. For example, storing an XML document containing configuration information will require either the configuration interface or the application to parse the document in order to read individual settings. It'll make updating a setting more complicated, though caching the settings can help to offset slower read performance.

Consider how the configuration interface will permit control of the scope and inheritance of configuration settings. For example, it might be a requirement to scope configuration settings at the organization, application, and the machine level. It might need to support delegation of control over access to different scopes, and to prevent or allow individual applications to override settings.

Ensure that the configuration interface can expose the configuration data in the required formats such as typed values, collections, key/value pairs, or property bags.

Consider how the configuration store interface will behave when settings contain errors, or don't exist in the backing store. It might be appropriate to return default settings and log errors. Also consider aspects such as the case sensitivity of configuration setting keys or names, the storage and handling of binary data, and the ways that null or empty values are handled.

Consider how to protect the configuration data to allow access to only the appropriate users and applications. This is likely a feature of the configuration store interface, but it's also necessary to ensure that the data in the backing store can't be accessed directly without the appropriate permission. Ensure strict separation between the permissions required to read and to write configuration data. Also consider whether you need to encrypt some or all of the configuration settings, and how this'll be implemented in the configuration store interface.

Centrally stored configurations, which change application behavior during runtime, are critically important and should be deployed, updated, and managed using the same mechanisms as deploying application code. For example, changes that can affect more than one application must be carried out using a full test and staged deployment approach to ensure that the change is appropriate for all applications that use this configuration. If an administrator edits a setting to update one application, it could adversely impact other applications that use the same setting.

If an application caches configuration information, the application needs to be alerted if the configuration changes. It might be possible to implement an expiration policy over cached configuration data so that this information is automatically refreshed periodically and any changes picked up (and acted on).

While caching configuration data can help address transient connectivity issues with the external configuration store at application runtime, this typically doesn't solve the problem if the external store is down when the application is first starting. Ensure your application deployment pipeline can provide the last known set of configuration values in a configuration file as a fallback if your application cannot retrieve live values when it starts.

When to use this pattern

This pattern is useful for:

  • Configuration settings that are shared between multiple applications and application instances, or where a standard configuration must be enforced across multiple applications and application instances.

  • A standard configuration system that doesn't support all of the required configuration settings, such as storing images or complex data types.

  • As a complementary store for some of the settings for applications, perhaps allowing applications to override some or all of the centrally-stored settings.

  • As a way to simplify administration of multiple applications, and optionally for monitoring use of configuration settings by logging some or all types of access to the configuration store.

Workload design

An architect should evaluate how the External Configuration Store pattern can be used in their workload's design to address the goals and principles covered in the Azure Well-Architected Framework pillars. For example:

PillarHow this pattern supports pillar goals
Operational Excellence helps deliver workload quality through standardized processes and team cohesion.This separation of application configuration from application code supports environment-specific configuration and applies versioning to configuration values. External configuration stores are also a common place to manage feature flags to enable safe deployment practices.

- OE:10 Automation design
- OE:11 Safe deployment practices

As with any design decision, consider any tradeoffs against the goals of the other pillars that might be introduced with this pattern.

Custom backing store example

In a Microsoft Azure hosted application, a possible choice for storing configuration information externally is to use Azure Storage. This is resilient, offers high performance, and is replicated three times with automatic failover to offer high availability. Azure Table storage provides a key/value store with the ability to use a flexible schema for the values. Azure Blob storage provides a hierarchical, container-based store that can hold any type of data in individually named blobs.

When implementing this pattern you'd be responsible for abstracting away Azure Blob storage and exposing your settings within your applications, including checking for updates at runtime and addressing how to respond to those.

The following example shows how a simplistic configuration store could be envisioned over Blob storage to store and expose configuration information. A BlobSettingsStore class could abstract Blob storage for holding configuration information, and implements a simple ISettingsStore interface.

public interface ISettingsStore{ Task<ETag> GetVersionAsync(); Task<Dictionary<string, string>> FindAllAsync();}

This interface defines methods for retrieving configuration settings held in the configuration store and includes a version number that can be used to detect whether any configuration settings have been modified recently. A BlobSettingsStore class could use the ETag property of the blob to implement versioning. The ETag property is updated automatically each time a blob is written.

By design, this simple illustration exposes all configuration settings as string values rather than typed values.

An ExternalConfigurationManager class could then provide a wrapper around a BlobSettingsStore instance. An application can use this class to retrieve configuration information. This class might use something like Microsoft Reactive Extensions to publish any changes made to the configuration while the system is running. It would also be responsible for implementing the Cache-Aside pattern for settings to provide added resiliency and performance.

Usage might look something like the following.

static void Main(string[] args){ // Start monitoring configuration changes. ExternalConfiguration.Instance.StartMonitor(); // Get a setting. var setting = ExternalConfiguration.Instance.GetAppSetting("someSettingKey"); …}

Using Azure App Configuration

While building a custom configuration store might be necessary in some situations, many applications can instead use Azure App Configuration. Azure App Configuration supports key-value pairs that can be namespaced. The keys are typed and are individually versioned. Azure App Configuration also supports point-in-time snapshots of configuration so that you can easily inspect or even roll back to prior configuration values. Configuration values can be exported such that a copy of the configuration can ship with your application in case the service is unreachable when the application is starting.

Client libraries

Many of these features are exposed through client libraries which integrate with the application runtime to facilitate fetching and caching values, refreshing values on change, and even handling transient outages of App Configuration Service.

RuntimeClient LibraryNotesQuickstart
.NETMicrosoft.Extensions.Configuration.AzureAppConfigurationProvider for Microsoft.Extensions.ConfigurationQuickstart
ASP.NETMicrosoft.Azure.AppConfiguration.AspNetCoreProvider for Microsoft.Extensions.ConfigurationQuickstart
Azure Functions in .NETMicrosoft.Extensions.Configuration.AzureAppConfigurationUsed with Azure Function extensions to support configuration in Startup.csQuickstart
.NET FrameworkMicrosoft.Configuration.ConfigurationBuilders.AzureAppConfigurationConfiguration builder for System.ConfigurationQuickstart
Java Springcom.azure.spring > azure-spring-cloud-appconfiguration-configSupports Spring Framework access via ConfigurationPropertiesQuickstart
Pythonazure.appconfigurationProvides an AzureAppConfigurationClientQuickstart
JavaScript/Node.js@azure/app-configurationProvides an AppConfigurationClientQuickstart

In addition to client libraries, there are also an Azure App Configuration Sync GitHub Action and Azure App Configuration Pull & Azure App Configuration Push Azure DevOps tasks to integrate configuration steps into your build process.

Next steps

  • See additional App Configuration Samples
  • Learn how to integrate Azure App Configuration with Kubernetes deployments
  • Learn how Azure App Configuration also can help manage feature flags
External Configuration Store pattern - Azure Architecture Center (2024)

FAQs

What is the externalized configuration design pattern? ›

External Configuration, or Configuration Externalization, is a design pattern where the configuration settings of an application are stored outside the codebase, typically in external configuration files or centralized configuration services.

Why externalize configuration? ›

Spring Boot lets you externalize your configuration so that you can work with the same application code in different environments. You can use properties files, YAML files, environment variables, and command-line arguments to externalize configuration.

Where to store application configuration? ›

These config files are typically placed under separate root directory than the rest of application code. For example, in case of Java they are typically under src/main/resources .

What is the Azure architecture? ›

Microsoft Azure architecture runs on a massive collection of servers and networking hardware, which, in turn, hosts a complex collection of applications that control the operation and configuration of the software and virtualized hardware on these servers. This complex orchestration is what makes Azure so powerful.

What is the preferred approach to externalizing configuration? ›

Quarkus supports multiple mechanisms for externalizing configurations such as environment variables, Maven properties, command-line arguments and more. The recommended approach for the long-term for externalizing configuration is however using an application.

What are the major benefits of spring externalized configuration? ›

For beginners, embracing externalized configuration offers several benefits:
  • Flexibility: Easily switch between different environments (development, testing, production) without changing the code.
  • Security: Keep sensitive information like passwords and API keys out of your version control system.
Apr 10, 2024

How do you externalize configuration using Spring Boot? ›

Externalized Configuration
  1. Accessing Command Line Properties.
  2. JSON Application Properties.
  3. External Application Properties.
  4. Optional Locations.
  5. Wildcard Locations.
  6. Profile Specific Files.
  7. Importing Additional Data.
  8. Importing Extensionless Files.

What are the advantages of externalization? ›

By converting our internal thought processes into an external form, externalization essentially gives us the ability to re-input information into our own brains via a different channel, which gives us access to additional cognitive resources we can use to process the same information in a different way.

Why do people externalize? ›

One common type of bias in automatic thoughts is 'externalization': we sometimes blame others for negative events or experiences and deny we are responsible. People might do this to protect their self-esteem, justify their actions (e.g., violence), or cope with difficult feelings (e.g., shame).

What is Azure app configuration Store? ›

Azure App Configuration is an Azure service designed to help you centrally manage your app settings and feature flags. In this quickstart, you learn how to create an App Configuration store and a key-value to the App Configuration store.

Where is most configuration information stored? ›

The answer: A) The registry

Windows consolidates all application and operating system configuration information into a large database called the Registry.

Where are configuration items stored? ›

CMDB stands for configuration management database, a file that clarifies the relationships between the hardware, software, and networks used by an IT organization. Your CMDB stores information on the configuration of items like hardware, software, systems, facilities, and even personnel.

What are the 5 pillars of Azure architecture? ›

The five pillars of the Azure Well-Architected Framework are reliability, cost optimization, operational excellence, performance efficiency, and security. While each pillar is important, the pillars can be prioritized based on your specific workload.

What is 3 tier architecture in Azure? ›

Three-tier architecture is a well-established software application architecture that organizes applications into three logical and physical computing tiers: the presentation tier, or user interface; the application tier, where data is processed; and the data tier, where the data associated with the application is ...

What is Azure called now? ›

Azure Active Directory (Azure AD), now known as Microsoft Entra ID, is an identity and access management solution from Microsoft that helps organizations secure and manage identities for hybrid and multicloud environments.

What are the three types of pattern design? ›

Design Patterns are categorized mainly into three categories: Creational Design Pattern, Structural Design Pattern, and Behavioral Design Pattern. These are differed from each other on the basis of their level of detail, complexity, and scale of applicability to the entire system being design.

What are the 4 basic categories for design patterns? ›

Design patterns can be classified into different types and categories, often grouped into classes and subclasses based on their characteristics and applications. The various types of design patterns include idioms, architectural patterns, creation, structural, and behavioral patterns.

How to use external configuration in Spring Boot? ›

Spring Boot will automatically find and load application.properties and application.yaml files from the following locations when your application starts:
  1. From the classpath. The classpath root. The classpath /config package.
  2. From the current directory. The current directory. The config/ subdirectory in the current directory.

What is MVVM structural design pattern? ›

Model–view–viewmodel (MVVM) is an architectural pattern in computer software that facilitates the separation of the development of the graphical user interface (GUI; the view)—be it via a markup language or GUI code—from the development of the business logic or back-end logic (the model) such that the view is not ...

Top Articles
Latest Posts
Article information

Author: Lakeisha Bayer VM

Last Updated:

Views: 6090

Rating: 4.9 / 5 (69 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Lakeisha Bayer VM

Birthday: 1997-10-17

Address: Suite 835 34136 Adrian Mountains, Floydton, UT 81036

Phone: +3571527672278

Job: Manufacturing Agent

Hobby: Skimboarding, Photography, Roller skating, Knife making, Paintball, Embroidery, Gunsmithing

Introduction: My name is Lakeisha Bayer VM, I am a brainy, kind, enchanting, healthy, lovely, clean, witty person who loves writing and wants to share my knowledge and understanding with you.