Lesson 5 of 6 Application Architecture Solutions

Centralizing Configuration and Feature Flags

This lesson explains Azure App Configuration and how it works with Key Vault.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe keys, labels and snapshots.
  • Explain feature flags.
  • Distinguish App Configuration from Key Vault.

The problem

A modern application may have dozens of services, each with settings that vary between environments. Keeping settings in each service's files causes drift, and changing one value may need several deployments. A central configuration store gives one place for settings, with history and access control, and lets applications load updated values without restarting.

Azure App Configuration

Azure App Configuration is a managed service that stores application settings as key and value pairs. Keys can be organized hierarchically, and labels allow one key to have different values for each environment, such as Dev and Prod. Applications load configuration through provider libraries and can refresh automatically when a value changes, usually using a sentinel key to indicate that a set of changes is ready.

Snapshots capture an immutable set of configuration at a moment, so that a deployment can use a known set, and a rollback can return to it. Applications should use a managed identity with an App Configuration data role instead of a connection string.

True or false

App Configuration basics

Exam skills 4.2.5

Check how Azure App Configuration works.

Log in to try this activity Interactive activities are free with an account.

Tiers

App Configuration has four tiers, and several capabilities depend on the tier.

TierSLAUse
FreeNoneExperiments
DeveloperNoneDevelopment and test
Standard99.9%, or 99.95% with geo-replicationProduction
Premium99.9%, or 99.99% with geo-replicationDemanding production workloads

Geo-replication and soft delete are available on Standard and Premium, and replicas in other regions help with availability and latency. Key Vault references and snapshots are available on all tiers.

Feature flags

A feature flag turns functionality on or off without deploying code. Releasing code and releasing a feature become separate actions. A team can deploy a new checkout page turned off, enable it for internal users, then for 10% of customers, and turn it off immediately if something goes wrong, with no rollback.

App Configuration has a dedicated feature manager, and filters can target percentages or specified groups. This supports canary releases and A/B testing, and flags should be removed once they have served their purpose, in order to avoid clutter in code.

Put in order

Releasing behind a flag

Exam skills 4.2.5

Arrange a feature flag rollout.

Log in to try this activity Interactive activities are free with an account.

Configuration and secrets

Azure App Configuration complements Azure Key Vault but does not replace it. App Configuration stores settings, while Key Vault stores secrets, with stronger protections. A Key Vault reference in App Configuration stores a pointer to a secret. The application reads all its settings in one place, and the provider retrieves the secret from Key Vault, using the application's own identity. The application therefore needs access to both services.

App Service and Azure Functions also have application settings, which are suitable for a single application with few settings, and they can use Key Vault references directly. App Configuration is justified when many services share settings, or when feature flags and dynamic refresh are required.

The following comparison recaps the options.

App Service settings
ContentSettings for one app
Dynamic refreshApp restarts
ScopeOne application
Choose when One small application
Azure App Configuration
ContentShared settings and feature flags
Dynamic refreshYes
ScopeMany applications
Choose when Many services sharing configuration
Azure Key Vault
ContentSecrets, keys, certificates
Dynamic refreshThrough client caching
ScopeAny authorized identity
Choose when Sensitive values

The following diagram shows where each setting is stored in a central configuration design for 30 microservices.

Central configuration for 30 microservices. Azure App Configuration holds shared settings labelled by environment and a feature flag with a 5% percentage filter for the recommendation engine; the shared database password stays in Key Vault, referenced from App Configuration; each service's managed identity reads both.
The scenario is illustrative.
Sort into groups

Where does it live?

Exam skills 4.2.5

Decide where each item of configuration should be stored.

Log in to try this activity Interactive activities are free with an account.
Worked example

Centralizing configuration

A retailer has 30 microservices across three environments. Settings differ by environment, a database password is shared by several services, and a new recommendation engine must be turned on for 5% of users with no redeployment. What should you recommend?

Azure App Configuration stores shared settings, with labels for each environment. The recommendation engine is released behind a feature flag with a percentage filter, so that it can be expanded or disabled with no deployment.

The database password belongs in Key Vault, referenced from App Configuration, with each service's managed identity granted access to both. Storing the password directly as a configuration value would bypass the protection of Key Vault, and separate application settings in each service would cause the drift that the design aims to remove.

Check yourself

Should a database password be stored as a plain value in App Configuration?

Show answer

No. Store it in Key Vault, and hold a Key Vault reference in App Configuration.

Exam Tips

Remember for the exam

  • App Configuration centralizes settings; labels separate environments.
  • Feature flags separate deployment from release.
  • Key Vault references keep secrets in Key Vault; the app needs access to both.
  • Geo-replication and soft delete need Standard or Premium.