Skip to content

03 - Configuration (Premium)

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

Premium plan basics

Premium (EP1) keeps at least one warm instance, supports VNet integration, private endpoints, and deployment slots. No cold-start penalty, with up to 100 instances and no execution timeout.

What You'll Build

You will standardize .NET isolated worker app settings for Premium, 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 - 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 5 - Verify effective settings

az functionapp config appsettings list \
  --name "$APP_NAME" \
  --resource-group "$RG" \
  --output table

Step 6 - Verify runtime behavior with info endpoint

curl --request GET "https://$APP_NAME.azurewebsites.net/api/info"

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-dnetprem-04100301"
}

Premium content share

Premium plans use Azure Files for content storage. The WEBSITE_CONTENTAZUREFILECONNECTIONSTRING and WEBSITE_CONTENTSHARE settings are automatically configured by az functionapp create and should not be removed.

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
WEBSITE_CONTENTAZUREFILECONNECTIONSTRING  DefaultEndpointsProtocol=https;AccountName=...       False
WEBSITE_CONTENTSHARE                      func-dnetprem-04100301...                            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

Next: 04 - Logging and Monitoring

See Also

Sources