I have a PreDeploy.ps1 script in a package deployed in a Azure App Service step.
The PreDeploy script is executing correctly, however it’s running in PowerShell 5, and I’d prefer to run in PowerShell 7 (it’s installed on the Octopus server)
You might be able to specify the desired Powershell version through the use of the system variableOctopus.Action.PowerShell.CustomPowerShellVersion.
If that doesn’t work then you may need to split the pre-deploy script into a separate Run an Azure Script step where you can use the Configure Features option to specify Powershell Core.
e.g.
What value is Octopus expecting in Octopus.Action.PowerShell.CustomPowerShellVersion?
I’ve gotten this error message for 7 and 7.2, but I suspect it’s trying to run Powershell, not PowerShell Core: