Azure App Configuration: Settings and Feature Flags
30-second answer
Azure App Configuration is a central store for app settings. Each setting is a key-value with an optional label (such as prod) and a content type. Feature flags live under the .appconfig.featureflag/ prefix, and Key Vault references point at secrets without storing them. In Python, load() from azure-appconfiguration-provider reads the keys you select, trims prefixes, resolves Key Vault references with a keyvault_credential, and refreshes when a sentinel key changes.
Exam objective: 4.1.2 Store and retrieve app configuration information by using Azure App Configuration. (Skills measured as of October 7, 2026)
Simulations
Feel it before you read it. No account needed, nothing leaves this page.
Open <strong>Operations → Configuration explorer</strong> and select <strong>+ Create → Key-value</strong>.
👆 Click the glowing item in the portal to continue
Read the steps as text
- Open Operations → Configuration explorer and select + Create → Key-value.
- A label lets one key hold different values per environment. Your app asks for the prod label in production.
- Same key, two labels. Now add a secret, but by reference: + Create → Key Vault reference.
- App Configuration stores only the secret URI. Your app’s identity reads the value from Key Vault.
- Open Feature manager and select + Create.
- Turn the semantic cache on for 20% of users first with a targeting filter.
- Something wrong? Toggle it Off here and every app instance stops using it within the refresh interval.
🧪 Simulation for learning. Screens are simplified versions of the Azure portal; names, prices and IDs are examples. Nothing here touches real Azure.
🖱️ Drag to rotate · scroll or pinch to zoom
App Configuration
Azure App Configuration holds settings as key-values with optional labels (dev, prod) and feature flags. It can point at Key Vault with Key Vault references. Apps refresh settings without restarting, often by watching a sentinel key.
🤔 What happens if…
Read this tour as text
- Secrets don’t belong in code. A connection string in
config.pyends up in git, in screenshots and in old laptops. Azure Key Vault stores secrets, keys and certificates. The app reads them at run time with a managed identity, so there’s no password to steal. - Versions and rotation. Each time you set a secret, Key Vault keeps a new version. Apps that ask for the secret without a version get the latest. Rotation creates a new version: for keys, a rotation policy does it on a schedule; for secrets, Key Vault raises a
SecretNearExpiryevent through Event Grid and your function sets the new value. Apps pick it up without a redeploy. - App Configuration. Azure App Configuration holds settings as key-values with optional labels (dev, prod) and feature flags. It can point at Key Vault with Key Vault references. Apps refresh settings without restarting, often by watching a sentinel key.
- A trace across services. One user question goes web API → queue → worker → Cosmos DB → model. OpenTelemetry gives every hop a span that shares one trace ID, so you see the whole journey. The Azure Monitor OpenTelemetry Distro sends it to Application Insights.
- Find the slow span. The trace shows each span’s duration. Here the model call is fine, but a Cosmos DB query without a partition key takes 2.4 seconds. Custom spans and attributes (like
tenant.id) make the story even clearer. - Logs live in tables. Application Insights and Log Analytics store telemetry in tables:
requests,dependencies,exceptions,traces, plus metrics. Container Apps logs land inContainerAppConsoleLogs_CL, AKS inContainerLogV2. - Ask with KQL. Kusto Query Language (KQL) reads top to bottom through pipes:
requests | where success == false | summarize count() by bin(timestamp, 5m) | render timechart.wherefilters,summarizeaggregates,projectpicks columns,joincombines tables. - Turn a query into an alert. A log search alert runs a KQL query on a schedule and fires when the result crosses a threshold. A metric alert watches a number like CPU or queue length. Either can email the team or call a webhook.
Keep the Cosmos DB key out of code and out of app settings. Store it in an RBAC vault, let a web app read it through a Key Vault reference, then load settings, labels and a feature flag from App Configuration.
🎓 Education-only simulation. Your lab is saved in this browser, so you can leave and continue later.
😟 THE PROBLEM
Switching to a new model means a full redeploy of six services.
😊 THE SOLUTION
Keep settings and feature flags in App Configuration and refresh them live.
- Redeploy to change a value✓ Dynamic refresh
- Different values per environment✓ Labels
- Risky roll-outs✓ Feature flags
Start with a question
You want to switch the chatbot to a newer model. Why does that need six redeploys?
Because the deployment name is typed into six services’ config files. Change it, rebuild six images, roll out six releases, and hope nobody missed one. Then, if the new model misbehaves, do it all again backwards.
Settings that many services share shouldn’t live inside each service. Azure App Configuration keeps them in one store. Change a value once, flip a feature flag for the new model, and every app reloads it in the next minute or so, without a restart.
Explain it like I’m 10
The technical explanation
What’s in a store
Each entry is a key-value:
| Part | Example | Notes |
|---|---|---|
| Key | ChatApp:Model:Deployment | Any string. : or / are common separators for a hierarchy. |
| Label | prod | Optional. Same key, different value per label. No label is the “null label”. |
| Value | gpt-4.1 | A string, up to the store’s size limit. |
| Content type | application/json | Optional. Tells the provider how to read the value. |
Two special kinds of key-value:
- Feature flags use keys under
.appconfig.featureflag/(for example.appconfig.featureflag/use-gpt-5) with the content typeapplication/vnd.microsoft.appconfig.ff+json;charset=utf-8. The value is JSON withenabledand optional filters (targeting a group, a percentage of users, a time window). - Key Vault references have the content type
application/vnd.microsoft.appconfig.keyvaultref+json;charset=utf-8and a value like{"uri":"https://kv-tailspin.vault.azure.net/secrets/cosmos-key"}. App Configuration stores only the URI.
az appconfig kv set -n appcs-tailspin --key ChatApp:Model:Deployment --value gpt-4.1 --label prod
az appconfig kv set-keyvault -n appcs-tailspin --key ChatApp:Cosmos:Key \
--secret-identifier https://kv-tailspin.vault.azure.net/secrets/cosmos-key --label prod
az appconfig feature set -n appcs-tailspin --feature use-gpt-5 --label prod
Access
Use Microsoft Entra ID, not access keys. The app’s managed identity gets App Configuration Data Reader on the store (Data Owner can also write). If the store has Key Vault references, the same identity needs Key Vault Secrets User on the vault, because the provider in your app fetches the secret, not App Configuration.
Load settings in Python
pip install azure-appconfiguration-provider azure-identity featuremanagement
import os
from azure.identity import DefaultAzureCredential
from azure.appconfiguration.provider import load, SettingSelector, WatchKey
from featuremanagement import FeatureManager
credential = DefaultAzureCredential()
config = load(
endpoint=os.environ["APP_CONFIG_ENDPOINT"], # https://appcs-tailspin.azconfig.io
credential=credential,
selects=[
SettingSelector(key_filter="ChatApp:*"), # no-label defaults first
SettingSelector(key_filter="ChatApp:*", label_filter="prod") # prod values win
],
trim_prefixes=["ChatApp:"], # "ChatApp:Model:Deployment" -> "Model:Deployment"
keyvault_credential=credential, # resolves Key Vault references
refresh_on=[WatchKey("ChatApp:Sentinel", label="prod")],
refresh_interval=60, # seconds between sentinel checks
feature_flag_enabled=True,
)
deployment = config["Model:Deployment"] # behaves like a read-only dict
cosmos_key = config["Cosmos:Key"] # already the secret value from Key Vault
features = FeatureManager(config)
def handle_request(question: str):
config.refresh() # cheap: checks the sentinel only when the interval has passed
model = "gpt-5" if features.is_enabled("use-gpt-5") else config["Model:Deployment"]
...
A few details that catch people:
- Order of selectors matters. Later selectors override earlier ones for the same key, so put the null-label defaults first and the environment label after.
refresh()is yours to call.refresh_onandrefresh_intervalonly say what to watch and how often to check. If you never callconfig.refresh(), nothing reloads.- The sentinel goes last. Change the five settings you need, then update
ChatApp:Sentinel. The app sees the sentinel change and reloads all of them together, so it never runs with half old, half new values.
-
1 Edit
You change several key-values in the store.
-
2 Sentinel
You update ChatApp:Sentinel last.
-
3 Check
config.refresh() runs; the interval has passed, so it reads the sentinel.
-
4 Reload
The sentinel changed, so every selected key is loaded again.
Snapshots
A snapshot is a named, read-only set of key-values captured from filters at one moment, for example release-2026-11. Load it with SettingSelector(snapshot_name="release-2026-11"). Because it can’t change, production runs exactly what you tested, and rollback means loading the previous snapshot.
Architect level App Configuration or Key Vault?
They do different jobs and usually work together. Key Vault is for values that would hurt if leaked; it has hardware-backed keys, rotation events and tight per-secret access. App Configuration is for everything else your app reads: deployment names, timeouts, prompt templates, feature flags. It has labels, snapshots, change history and fast refresh. Putting plain settings in Key Vault makes them awkward to change and costs more operations; putting secrets in App Configuration means anyone with Data Reader can read them. The Key Vault reference joins the two: one config source in code, secrets still guarded by Key Vault.
Real-world business scenario
Contoso Learning (fictional)
- The problem
- Six services in Container Apps each had the model deployment name and prompt settings in environment variables. Every model change took a day of redeploys, and dev settings once leaked into production.
- What they used
- One App Configuration store with dev and prod labels, a use-gpt-5 feature flag with a targeting filter for teachers, Key Vault references for the Cosmos DB key, and the Python provider refreshing on a sentinel key every 60 seconds.
- Why that choice
- Settings changed in one place reach every service in about a minute, labels keep environments apart, and the secrets themselves stay in Key Vault.
- The result
- The team switched teachers to the new model on a Tuesday afternoon, watched the results, and rolled it out to students on Thursday without a single deployment.
When to use it and when not to
✓ Use it when…
- Several services share settings such as model deployment names or endpoints.
- You want feature flags to roll out a new model or prompt gradually.
- You need different values per environment, change history or immutable release snapshots.
✕ Think twice when…
- Storing secret values directly. Keep them in Key Vault and add a reference.
- A single small app with a couple of settings that never change. App settings are enough.
↔ Alternatives to consider
- Azure Key Vault for the secrets themselves.
- App settings in App Service or Container Apps for values that belong to one app only.
Test yourself with exercises
5 original practice questions in the AI-200 style. Pick your answers, then check them. You will see why each option is right or wrong. Score 75% or more and this topic is marked complete.
Interview preparation
Say your answer out loud first, then open the model answer. Interviewers care more about your reasoning than the exact words.
Beginner Why use App Configuration when App Service already has app settings?
Model answer
App settings belong to one app. When six services share the same model deployment name and endpoint, I'd rather change it once. App Configuration gives me one store with labels for each environment, feature flags and a change history, and apps can refresh without restarting.
Intermediate Should you store an API key in App Configuration?
Model answer
No. I store the key in Key Vault and add a Key Vault reference in App Configuration. The reference holds only the secret's URI. The app's provider reads the URI and fetches the secret from Key Vault using its own identity, so App Configuration never sees the value.
Interviewer follows up
What permissions does the app need then?
You
App Configuration Data Reader on the store, and Key Vault Secrets User on the vault, because the app itself reads the secret.
Experienced developer How do you make a Python app pick up a changed setting without a restart?
Model answer
I pass refresh_on with a WatchKey for a sentinel key and a refresh_interval to load(), then call config.refresh() regularly, for example once per request or in a background loop. When the interval has passed, the provider checks the sentinel. If it changed, it reloads every selected key.
Scenario You want to try a new model with internal users first, then everyone. How?
Model answer
A feature flag in App Configuration, say use-gpt-5, with a targeting filter for the internal group. The code checks feature_manager.is_enabled("use-gpt-5") and picks the deployment. When I'm happy, I widen the audience or switch the flag on for everyone. No redeploy either way.
Architecture & design How would you make a release's configuration repeatable and easy to roll back?
Model answer
I'd create a snapshot of the release's key-values, for example release-2026-11, and have production load that snapshot by name. A snapshot can't change, so production sees exactly what was tested. Rolling back means pointing at the previous snapshot.
Quick revision
Key points
- Settings are key-values with optional labels and content types.
- Feature flags are key-values under .appconfig.featureflag/.
- Key Vault references store a secret URI. The app's provider fetches the secret with its own identity.
- load(endpoint, credential, selects, trim_prefixes, refresh_on, refresh_interval, keyvault_credential) builds a dict-like config.
- Dynamic refresh needs refresh_on (a sentinel key) plus calling config.refresh().
- Apps need App Configuration Data Reader; Data Owner can write.
Important terminology
- Azure App Configuration
- A managed service that stores application settings and feature flags centrally for many apps and environments.
- Key-value
- One setting in App Configuration, made of a key, a value, an optional label and an optional content type.
- Label
- An extra attribute on a key-value that lets the same key hold different values, usually one per environment.
- Feature flag
- An on or off switch, stored as a key-value with the .appconfig.featureflag/ prefix, that turns code paths on without a redeploy.
- Key Vault reference
- A key-value whose value is the URI of a Key Vault secret. The app's provider fetches the secret from Key Vault.
- Sentinel key
- One key you update last after a batch of changes. The app watches it and reloads all settings when it changes.
- Snapshot
- A named, read-only copy of a set of key-values at one moment, used for safe releases and rollbacks.
Common mistakes
- Putting secret values straight into App Configuration instead of Key Vault references.
- Setting refresh_on but never calling refresh(), so nothing changes.
- Forgetting Key Vault Secrets User for the app, so Key Vault references fail to resolve.
Exam tips
- "Same key, different value per environment" = labels.
- "Turn a feature on without redeploying" = feature flag.
- "Reload all settings only after a batch of changes" = sentinel key with refresh_on.
- "Immutable set of settings for a release" = snapshot.
Five quick revision questions
-
1.Which prefix do feature flag keys use?Show
.appconfig.featureflag/
-
2.Which Python package provides load()?Show
azure-appconfiguration-provider.
-
3.Which load() argument strips a prefix from key names?Show
trim_prefixes.
-
4.Which role lets an app read key-values?Show
App Configuration Data Reader.
-
5.Where does the secret value of a Key Vault reference live?Show
In Key Vault. App Configuration stores only its URI.
Official references
Finished this lesson? Tick it off. Your progress is saved in this browser.
Next up: Distributed Tracing with OpenTelemetry
Lesson done? Make it stick with a quick gameSort It, Match the Pairs, Lightning Round and Who Am I? Earn XP and badges.