Skip to content

Commit 10cb4be

Browse files
Merge pull request #313962 from msangapu-msft/patch-30
Update article date and add local development notes
2 parents 45ba36b + b9ae9a7 commit 10cb4be

1 file changed

Lines changed: 59 additions & 9 deletions

File tree

articles/app-service/app-service-configuration-references.md

Lines changed: 59 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Set up Azure App Service and Azure Functions to use App Configurati
44
author: muksvso
55

66
ms.topic: how-to
7-
ms.date: 05/08/2025
7+
ms.date: 03/30/2026
88
ms.author: mubatra
99

1010
#customer intent: As a developer, I want to use Azure App Configuration references so that I can make configuration key/value pairs available to code.
@@ -17,6 +17,20 @@ ms.custom: sfi-ropc-nochange
1717

1818
This article shows how to work with configuration data in Azure App Service or Azure Functions applications without making any code changes. [Azure App Configuration](../azure-app-configuration/overview.md) is an Azure service that you can use to centrally manage application configuration. It's also an effective tool for auditing your configuration values over time or across releases.
1919

20+
## Important notes for Azure Functions local development
21+
22+
App Configuration references (`@Microsoft.AppConfiguration(...)`) are resolved by the Azure App Service/Functions platform when your app runs in Azure.
23+
24+
- **Azure (supported):** Put the reference in your function app's **Application settings** (for example, in the Azure portal, ARM/Bicep, or other deployment tooling).
25+
- **Local (not supported):** The Functions host running on your development machine doesn't resolve `@Microsoft.AppConfiguration(...)` values from *local.settings.json*.
26+
- **User secrets (not supported):** The Functions user secrets store (*secrets.json*) is also not processed for `@Microsoft.AppConfiguration(...)` references.
27+
- **SDK code (not required for this feature):** Calling `AddAzureAppConfiguration()` configures the App Configuration SDK for in-process resolution, but it doesn't make the platform resolve `@Microsoft.AppConfiguration(...)` references locally.
28+
29+
If you want the same configuration values locally, use one of the following approaches:
30+
31+
- Add the values directly to *local.settings.json* (for example, set `MySetting` to the literal value you want locally).
32+
- Use the App Configuration SDK in your app code (for example, by configuring `AddAzureAppConfiguration()` and connecting to your store with a connection string or credentials appropriate for local dev). This approach is separate from platform references.
33+
2034
## Grant app access to App Configuration
2135

2236
To get started with using App Configuration references in App Service, first you create an App Configuration store. You then grant permissions to your app to access the configuration key/value pairs that are in the store.
@@ -78,20 +92,58 @@ An App Configuration reference has the form `@Microsoft.AppConfiguration({refere
7892
Here's an example of a complete reference that includes `Label`:
7993
8094
```json
81-
@Microsoft.AppConfiguration(Endpoint=https://myAppConfigStore.azconfig.io; Key=myAppConfigKey; Label=myKeyLabel)
95+
@Microsoft.AppConfiguration(Endpoint=https://myAppConfigStore.azconfig.io; Key=myAppConfigKey; Label=myKeyLabel)
8296
```
8397

8498
Here's an example that doesn't include `Label`:
8599

86100
```json
87-
@Microsoft.AppConfiguration(Endpoint=https://myAppConfigStore.azconfig.io; Key=myAppConfigKey)
101+
@Microsoft.AppConfiguration(Endpoint=https://myAppConfigStore.azconfig.io; Key=myAppConfigKey)
88102
```
89103

90104
Any configuration change to the app that results in a site restart causes an immediate refetch of all referenced key/value pairs from the App Configuration store.
91105

92106
> [!NOTE]
93107
> Automatic refresh and refetch of these values when the key/value pairs are updated in App Configuration isn't currently supported.
94108
109+
## Working example (Azure Functions)
110+
111+
The following example shows where the `@Microsoft.AppConfiguration(...)` syntax goes for an Azure Functions app.
112+
113+
### 1) Create a key/value in App Configuration
114+
115+
In your App Configuration store, create a key/value pair:
116+
117+
- **Key:** `Demo:Color`
118+
- **Label:** (optional) `dev`
119+
- **Value:** `Blue`
120+
121+
### 2) Add an application setting to your function app in Azure
122+
123+
In your Function App (in Azure), add an application setting named `Demo__Color` and set its value to an App Configuration reference.
124+
125+
> [!NOTE]
126+
> Use double underscores (`__`) if you want .NET configuration binding to map to `Demo:Color`.
127+
128+
**Application setting name**
129+
130+
```text
131+
Demo__Color
132+
```
133+
134+
**Application setting value**
135+
136+
```text
137+
@Microsoft.AppConfiguration(Endpoint=https://myAppConfigStore.azconfig.io; Key=Demo:Color; Label=dev)
138+
```
139+
140+
### 3) Read the setting in your function code
141+
142+
At runtime, your code reads `Demo:Color` like any other app setting.
143+
144+
> [!TIP]
145+
> You don't need to call `AddAzureAppConfiguration()` for platform references. Use `AddAzureAppConfiguration()` only when you want to load configuration directly via the SDK.
146+
95147
## Source application settings from App Configuration
96148

97149
You can use App Configuration references as values for [application settings](configure-common.md#configure-app-settings) so you can keep configuration data in App Configuration instead of in the site configuration settings. Application settings and App Configuration key/value pairs are both securely encrypted at rest. If you need centralized configuration management capabilities, add configuration data to App Configuration.
@@ -162,8 +214,8 @@ Here's a sample template for a function app that has App Configuration reference
162214
"[resourceId('Microsoft.AppConfiguration/configurationStores', variables('appConfigStoreName'))]"
163215
],
164216
"properties": {
165-
"WEBSITE_FONTNAME": "[concat('@Microsoft.AppConfiguration(Endpoint=', reference(resourceId('Microsoft.AppConfiguration/configurationStores', variables('appConfigStoreName'))).endpoint,'; Key=',variables('FontNameKey'),'; Label=',variables('myLabel'), ')')]",
166-
"WEBSITE_FONTCOLOR": "[concat('@Microsoft.AppConfiguration(Endpoint=', reference(resourceId('Microsoft.AppConfiguration/configurationStores', variables('appConfigStoreName'))).endpoint,'; Key=',variables('FontColorKey'),'; Label=',variables('myLabel'), ')')]",
217+
"WEBSITE_FONTNAME": "[concat('@Microsoft.AppConfiguration(Endpoint=', reference(resourceId('Microsoft.AppConfiguration/configurationStores', variables('appConfigStoreName'))).endpoint,'; Key=',variables('FontNameKey'),'; Label=',variables('myLabel'), ')]",
218+
"WEBSITE_FONTCOLOR": "[concat('@Microsoft.AppConfiguration(Endpoint=', reference(resourceId('Microsoft.AppConfiguration/configurationStores', variables('appConfigStoreName'))).endpoint,'; Key=',variables('FontColorKey'),'; Label=',variables('myLabel'), ')]",
167219
"WEBSITE_ENABLE_SYNC_UPDATE_SITE": "true"
168220
//...
169221
}
@@ -202,7 +254,6 @@ Here's a sample template for a function app that has App Configuration reference
202254
//...
203255
"dependsOn": [
204256
"[resourceId('Microsoft.AppConfiguration/configurationStores', variables('appConfigStoreName'))]"
205-
206257
],
207258
"properties": {
208259
"value": "Calibri",
@@ -216,7 +267,6 @@ Here's a sample template for a function app that has App Configuration reference
216267
//...
217268
"dependsOn": [
218269
"[resourceId('Microsoft.AppConfiguration/configurationStores', variables('appConfigStoreName'))]"
219-
220270
],
221271
"properties": {
222272
"value": "Blue",
@@ -226,8 +276,8 @@ Here's a sample template for a function app that has App Configuration reference
226276
]
227277
},
228278
{
229-
"scope": "[resourceId('Microsoft.AppConfiguration/configurationStores', variables('appConfigStoreName'))]",
230-
"type": "Microsoft.Authorization/roleAssignments",
279+
"scope": "[resourceId('Microsoft.AppConfiguration/configurationStores', variables('appConfigStoreName')]
280+
,"type": "Microsoft.Authorization/roleAssignments",
231281
"apiVersion": "2020-04-01-preview",
232282
"name": "[parameters('roleNameGuid')]",
233283
"properties": {

0 commit comments

Comments
 (0)