-
Notifications
You must be signed in to change notification settings - Fork 53
Upgrading your Azure Function Apps to run on PowerShell 7.2
MadhuraBharadwaj-MSFT edited this page Jul 11, 2022
·
6 revisions
Follow this guide to upgrade your existing Azure PowerShell Function Apps to PowerShell 7.2.
To run your Function App on PowerShell 7.2, ensure the Functions Runtime version is set to ~4.
- 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"
}
}
- 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
- 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
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”,
...
}