03 - Configuration (Dedicated)¶
Apply environment settings, runtime configuration, and host-level options so the same artifact can run across environments.
Prerequisites¶
| Tool | Version | Purpose |
|---|---|---|
| .NET SDK | 8.0 (LTS) | Build and run isolated worker functions |
| Azure Functions Core Tools | v4 | Start local host and publish artifacts |
| Azure CLI | 2.61+ | Provision Azure resources and inspect app state |
Dedicated plan basics
Dedicated (App Service Plan) runs on pre-provisioned compute with predictable cost. Always On keeps the host loaded for non-HTTP triggers. Supports VNet integration and deployment slots on eligible SKUs. No execution timeout limit.
What You'll Build¶
You will standardize .NET isolated worker app settings for Dedicated, keep environment-specific values outside the artifact, and verify effective configuration from Azure.
flowchart TD
A[local.settings.json] --> B[App Settings in Azure]
B --> C[Functions host]
C --> D[dotnet-isolated worker startup]
D --> E[Function method behavior] Steps¶
Step 1 - Baseline local settings¶
The reference app includes a local.settings.json.example template:
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated",
"QueueStorage": "UseDevelopmentStorage=true",
"EventHubConnection": "Endpoint=sb://placeholder.servicebus.windows.net/;SharedAccessKeyName=placeholder;SharedAccessKey=cGxhY2Vob2xkZXI=;EntityPath=events"
}
}
Local vs Azure settings
local.settings.json is used only for local development. In Azure, app settings are stored as environment variables in the Function App configuration.
Step 2 - Configure app settings in Azure¶
az functionapp config appsettings set \
--name "$APP_NAME" \
--resource-group "$RG" \
--settings \
"APP_ENV=production" \
"AZURE_FUNCTIONS_ENVIRONMENT=Production"
Step 3 - Set runtime guardrails¶
az functionapp config appsettings set \
--name "$APP_NAME" \
--resource-group "$RG" \
--settings \
"FUNCTIONS_EXTENSION_VERSION=~4" \
"FUNCTIONS_WORKER_RUNTIME=dotnet-isolated"
Step 4 - Enable Always On for non-HTTP triggers¶
Always On is critical for Dedicated
Without Always On, the app may unload after idle periods, causing timer and queue triggers to stop firing. Always On is available on Basic (B1) and higher SKUs.
Step 5 - Review Program.cs for isolated hosting¶
Ensure the host builder uses the ASP.NET Core integration model:
using Microsoft.Azure.Functions.Worker;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
var host = new HostBuilder()
.ConfigureFunctionsWebApplication()
.ConfigureServices(services =>
{
services.AddApplicationInsightsTelemetryWorkerService();
services.ConfigureFunctionsApplicationInsights();
})
.Build();
host.Run();
Isolated worker model
The .NET isolated worker uses ConfigureFunctionsWebApplication() with ASP.NET Core integration. HTTP functions use HttpRequest and IActionResult from ASP.NET Core, and logging is constructor-injected with ILogger<T>.
Step 6 - Verify effective settings¶
az functionapp config appsettings list \
--name "$APP_NAME" \
--resource-group "$RG" \
--output table
Step 7 - Verify runtime behavior with info endpoint¶
The /api/info endpoint reads environment variables at runtime, confirming the deployed configuration:
{
"name": "azure-functions-dotnet-guide",
"version": "1.0.0",
"dotnet": ".NET 8.0.23",
"os": "Linux",
"environment": "production",
"functionApp": "func-dnetded-04100301"
}
Verification¶
App settings output (showing key fields):
Name Value SlotSetting
---------------------------------------- --------------------------------------------------- -----------
FUNCTIONS_WORKER_RUNTIME dotnet-isolated False
FUNCTIONS_EXTENSION_VERSION ~4 False
APP_ENV production False
AZURE_FUNCTIONS_ENVIRONMENT Production False
AzureWebJobsStorage DefaultEndpointsProtocol=https;AccountName=... False
APPLICATIONINSIGHTS_CONNECTION_STRING InstrumentationKey=<instrumentation-key>;... False
QueueStorage DefaultEndpointsProtocol=https;AccountName=... False
EventHubConnection Endpoint=sb://placeholder.servicebus.windows.net/;...False
Sensitive values in app settings
Connection strings and keys appear in the output. In production, use Azure Key Vault references instead of storing secrets directly in app settings.
Next Steps¶
See Also¶
- Tutorial Overview & Plan Chooser
- .NET Language Guide
- Platform: Hosting Plans
- Operations: Deployment
- Recipes Index