-
Notifications
You must be signed in to change notification settings - Fork 53
Upgrading your Azure Function Apps to run on PowerShell 7.2
Note: Support for PowerShell 7.0 in Azure Functions has ended on 3 December 2022. While your existing PowerShell Function Apps running on 7.0 will continue to run, we'll no longer provide updates or customer service for PowerShell 7.0. To ensure that your Functions apps are fully supported, you'll need to upgrade them to PowerShell 7.2. Learn more about PowerShell End-of-support dates.
To run your Function App on PowerShell 7.2, ensure the value of FUNCTIONS_EXTENSION_VERSION is set to ~4.
In PowerShell Functions, the value "~7" for FUNCTIONS_WORKER_RUNTIME_VERSION refers to "7.0.x". We do not automatically upgrade PowerShell Function apps that have "~7" to "7.2". Going forward we will require that apps specify both the major and minor version they want to target. Hence, it is necessary to mention "7.2" if you want to target "7.2.x"
- Open your Azure Functions App using VS Code
- Navigate to "local.setting.json"
- Add the property "FUNCTIONS_WORKER_RUNTIME_VERSION" and set the value to "7.2".
The local.settings.json file should look like:
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "",
"FUNCTIONS_WORKER_RUNTIME": "powershell",
"FUNCTIONS_WORKER_RUNTIME_VERSION" : "7.2"
}
}
Note: Upgrading the language version of Linux Function Apps is currently not supported via the portal experience. For Linux, follow the instructions below for PowerShell/ARM
- Login to Azure Portal
- Navigate To Azure Functions Portal
- On the left Panel, click on Configuration under Settings
- Click on Function Runtime Settings blade, verify that the Runtime version is set to ~4. If not, set it to ~4 and click Save
- Click on General settings blade, change the PowerShell Version Setting to 7.2. Click Save
- To verify that your function app is running on Azure Functions Runtime v4, execute the following commands
$SubId = …
$ResourceGroupName = ...
$AppName = ...
Get-AzFunctionAppSetting -Name $AppName -ResourceGroupName $ResourceGroupName -SubscriptionId $SubId
- If the value of the AppSetting FUNCTIONS_EXTENSION_VERSION is not set to ~4, that means you are not running on the latest Azure Functions v4 runtime. Execute the following command to upgrade:
Set-AzResource -ResourceId "/subscriptions/$SubId/resourceGroups/$ResourceGroupName/providers/Microsoft.Web/sites/$AppName/config/appsettings" -UsePatchSemantics -Properties @{ FUNCTIONS_EXTENSION_VERSION = '~4' } -Force
- When running on Windows, you also need to enable .NET 6.0, which is required by version 4.x of the runtime.
Set-AzResource -ResourceId "/subscriptions/$SubId/resourceGroups/$ResourceGroupName/providers/Microsoft.Web/sites/$AppName/config/web" -UsePatchSemantics -Properties @{ "NetFrameworkVersion" = 'v6.0' } -Force
- Once the Azure Function runtime is upgraded to v4, execute the command below to migrate to PowerShell 7.2:
Set-AzResource -ResourceId "/subscriptions/$SubId/resourceGroups/$ResourceGroupName/providers/Microsoft.Web/sites/$AppName/config/web" -UsePatchSemantics -Properties @{ powerShellVersion = '7.2' } -Force
- Since Linux support for Azure Function PowerShell Apps was not available prior to Functions Runtime v4, your App should already be on Functions Runtime v4. To upgrade your Linux PowerShell Function App to 7.2, execute the command below:
Set-AzResource -ResourceId "/subscriptions/$SubId/resourceGroups/$ResourceGroupName/providers/Microsoft.Web/sites/$AppName/config/web" -UsePatchSemantics -Properties @{ linuxFxVersion = 'PowerShell|7.2' } -Force
In your ARM template, please specify these settings:
"siteConfig": {
"appSettings": [
...
{
"name": "FUNCTIONS_EXTENSION_VERSION",
"value": "~4"
},
{
"name": "FUNCTION_WORKER_RUNTIME",
"value": "powershell"
},
...
],
...
"powerShellVersion": "7.2",
...
}
"siteConfig": {
"appSettings": [
...
{
"name": "FUNCTIONS_EXTENSION_VERSION",
"value": "~4"
},
{
"name": "FUNCTION_WORKER_RUNTIME",
"value": "powershell"
},
...
],
...
"linuxFxVersion": "PowerShell|7.2",
...
}