Skip to content

Commit f4a7db9

Browse files
authored
Merge pull request #112334 from kulkarnisonia16/kulkarnisonia16-patch-1
Making the warning clearer and adding note
2 parents 164a1ab + f95e266 commit f4a7db9

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

articles/azure-functions/functions-reference-java.md

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,9 @@ Functions lets you customize the Java virtual machine (JVM) used to run your Jav
154154

155155
You can provide additional arguments in an app setting named `JAVA_OPTS`. You can add app settings to your function app deployed to Azure in the Azure portal or the Azure CLI.
156156

157+
> [!IMPORTANT]
158+
> In the Consumption plan, you must also add the WEBSITE_USE_PLACEHOLDER setting with a value of 0 for the customization to work. This setting does increase the cold start times for Java functions.
159+
157160
### Azure portal
158161

159162
In the [Azure portal](https://portal.azure.com), use the [Application Settings tab](functions-how-to-use-azure-function-app-settings.md#settings) to add the `JAVA_OPTS` setting.
@@ -162,16 +165,22 @@ In the [Azure portal](https://portal.azure.com), use the [Application Settings t
162165

163166
You can use the [az functionapp config appsettings set](/cli/azure/functionapp/config/appsettings) command to set `JAVA_OPTS`, as in the following example:
164167

168+
#### [Consumption plan](#tab/consumption)
169+
```azurecli-interactive
170+
az functionapp config appsettings set \
171+
--settings "JAVA_OPTS=-Djava.awt.headless=true" \
172+
"WEBSITE_USE_PLACEHOLDER=0" \
173+
--name <APP_NAME> --resource-group <RESOURCE_GROUP>
174+
```
175+
#### [Dedicated plan / Premium plan](#tab/dedicated+premium)
165176
```azurecli-interactive
166-
az functionapp config appsettings set --name <APP_NAME> \
167-
--resource-group <RESOURCE_GROUP> \
168-
--settings "JAVA_OPTS=-Djava.awt.headless=true"
177+
az functionapp config appsettings set \
178+
--settings "JAVA_OPTS=-Djava.awt.headless=true" \
179+
--name <APP_NAME> --resource-group <RESOURCE_GROUP>
169180
```
170-
This example enables headless mode. Replace `<APP_NAME>` with the name of your function app, and `<RESOURCE_GROUP>` with the resource group.
181+
---
171182

172-
> [!WARNING]
173-
> In the [Consumption plan](functions-scale.md#consumption-plan), you must add the `WEBSITE_USE_PLACEHOLDER` setting with a value of `0`.
174-
This setting does increase the cold start times for Java functions.
183+
This example enables headless mode. Replace `<APP_NAME>` with the name of your function app, and `<RESOURCE_GROUP>` with the resource group.
175184

176185
## Third-party libraries
177186

@@ -442,6 +451,9 @@ public class Function {
442451

443452
```
444453

454+
> [!NOTE]
455+
> The value of AppSetting FUNCTIONS_EXTENSION_VERSION should be ~2 or ~3 for an optimized cold start experience.
456+
445457
## Next steps
446458

447459
For more information about Azure Functions Java development, see the following resources:

0 commit comments

Comments
 (0)