Skip to content

03 - Configuration (Premium)

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

Premium plan basics

Premium (EP) runs on always-warm workers with pre-warmed instances, supports VNet integration, deployment slots, and removes the 10-minute execution timeout. EP1 provides 1 vCPU and 3.5 GB memory per instance.

What You'll Build

You will standardize Java runtime 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[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"

Premium JVM tuning

Premium EP1 provides 3.5 GB memory per instance. Setting -Xmx512m is conservative — you can increase to -Xmx1g or higher depending on your workload. 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-jprem-04100200"
}

Step 7 - Verify Premium-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 is enabled by default on Premium

Unlike Consumption where Always On is not available, Premium enables it by default. This keeps the function app warm and eliminates cold starts.

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/;...
WEBSITE_CONTENTSHARE                    func-jprem-04100200edf38b61b3ce
WEBSITE_CONTENTAZUREFILECONNECTIONSTRING DefaultEndpointsProtocol=https;AccountName=...

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.

Premium-specific settings

Premium plans include WEBSITE_CONTENTSHARE and WEBSITE_CONTENTAZUREFILECONNECTIONSTRING for Azure Files content share — these are auto-configured and should not be modified manually.

Next Steps

Next: 04 - Logging and Monitoring

See Also

Sources