Skip to content

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.

Developing PowerShell 7.2 function apps locally using VS Code

  1. Open your Azure Functions App using VS Code
  2. Navigate to "local.setting.json"
  3. 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" 
 } 
} 

Upgrading your Function App to run on PowerShell 7.2

Using Azure Portal

  1. Login to Azure Portal
  2. Navigate To Azure Functions Portal
  3. On the left Panel, click on Configuration under Settings
  4. Click on Function Runtime Settings blade, verify that the Runtime version is set to ~4. If not, set it to ~4 and click Save

Functions Runtime Settings


  1. Click on General settings blade, change the PowerShell Version Setting to 7.2. Click Save PowerShell Version

Using Azure PowerShell

  1. 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  
  1. 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 
  1. 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 

Creating Azure Functions using PowerShell 7.2 in ARM template

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”, 
            ... 
        } 
Clone this wiki locally