Skip to content

03 - Configuration (Dedicated)

Apply environment settings, JVM arguments, and host-level configuration so the same artifact can run across environments.

Prerequisites

Tool Version Purpose
JDK 17+ Compile and run Java functions locally
Maven 3.6+ Build and package Java artifacts
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 functions on standard App Service infrastructure with predictable pricing. B1 provides 1 vCPU, 1.75 GB memory. It supports Always On, manual/auto-scale, deployment slots, and VNet integration.

What You'll Build

You will standardize Java runtime 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[Java 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": "java",
    "FUNCTIONS_EXTENSION_VERSION": "~4",
    "QueueStorage": "UseDevelopmentStorage=true",
    "EventHubConnection__fullyQualifiedNamespace": "placeholder.servicebus.windows.net"
  }
}

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" \
    "JAVA_OPTS=-Xmx512m"

Step 3 - Set JVM and runtime guardrails

az functionapp config appsettings set \
  --name "$APP_NAME" \
  --resource-group "$RG" \
  --settings \
    "FUNCTIONS_EXTENSION_VERSION=~4" \
    "JAVA_OPTS=-Xmx512m -XX:+UseContainerSupport"

Dedicated JVM tuning

Dedicated B1 provides 1.75 GB memory. Setting -Xmx512m is conservative. For larger SKUs (S1, P1v2), you can increase the heap. The UseContainerSupport flag ensures the JVM respects container memory limits.

Step 4 - Validate pom.xml dependency and plugin

Ensure the Maven project includes the Azure Functions Java library:

<dependency>
    <groupId>com.microsoft.azure.functions</groupId>
    <artifactId>azure-functions-java-library</artifactId>
    <version>3.1.0</version>
</dependency>

And the Maven plugin for packaging:

<plugin>
    <groupId>com.microsoft.azure</groupId>
    <artifactId>azure-functions-maven-plugin</artifactId>
    <version>1.34.0</version>
    <configuration>
        <appName>${functionAppName}</appName>
        <resourceGroup>${functionResourceGroup}</resourceGroup>
        <runtime>
            <os>linux</os>
            <javaVersion>17</javaVersion>
        </runtime>
    </configuration>
</plugin>

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-java-guide",
  "version": "1.0.0",
  "java": "17.0.14",
  "os": "Linux",
  "environment": "production",
  "functionApp": "func-jded-04100220"
}

Step 7 - Verify Dedicated-specific configuration

az functionapp config show \
  --name "$APP_NAME" \
  --resource-group "$RG" \
  --query "{linuxFxVersion:linuxFxVersion, alwaysOn:alwaysOn, numberOfWorkers:numberOfWorkers}" \
  --output table

Expected output:

LinuxFxVersion    AlwaysOn    NumberOfWorkers
----------------  ----------  -----------------
Java|17           True        1

Always On on Dedicated

Like Premium, Dedicated enables Always On by default. This keeps the function app warm and eliminates cold starts.

No Azure Files content share on Dedicated

Unlike Premium and Consumption, Dedicated plans do NOT use WEBSITE_CONTENTSHARE or WEBSITE_CONTENTAZUREFILECONNECTIONSTRING. Deployment artifacts are stored directly on the App Service file system.

Verification

App settings output (showing key fields):

Name                                    Value
--------------------------------------  -----------------------------------------------
FUNCTIONS_WORKER_RUNTIME                java
FUNCTIONS_EXTENSION_VERSION             ~4
APP_ENV                                 production
JAVA_OPTS                               -Xmx512m -XX:+UseContainerSupport
AzureWebJobsStorage                     DefaultEndpointsProtocol=https;AccountName=...
APPLICATIONINSIGHTS_CONNECTION_STRING   InstrumentationKey=<instrumentation-key>;...
QueueStorage                            DefaultEndpointsProtocol=https;AccountName=...
EventHubConnection                      Endpoint=sb://placeholder.servicebus.windows.net/;...

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