I am deploying an app service with the built in 'Deploy an Azure App Service' step. It fails with this error:
The term 'Remove-WebConfigurationLock' is not recognized as the name of a cmdlet, function, script file, or operable program.
I have another project that is working and the logs show that it uses a different version of PowerShell. I am pretty sure the problem is that I can't pick PowerShell Core with this step. I don't know why the other one uses it.
When using the built in 'Deploy an Azure App Service' step, I don't have an option that allows me to use PowerShell Core.
When I run a basic PowerShell Script step, I do have the option of using PowerShell Core. I add it using the 'Configure Feature' button below.
There is no 'Configure Feature' button on the 'Deploy an Azure App Service' step.
How do I get the 'Deploy an Azure App Service' step to use PowerShell Core?
UPDATE:
Two projects that I created are using PowerShell core (PS7), but I didn't do anything to cause that (that I can find).
My newest project is using PowserShell Desktop (PS5).
The new project, that uses PS5, is using PS7 on an earlier step.



Updated :-
I have tried using
Default Worker poolwith Powershell set to Windows Desktop and thePS-version is also 5.1. My Powershell Script below worked successfully.Output:- Powershell Version - 5.1
Worker Pool - Default Worker Pool PowerShell Edition - Windows Powershell (Desktop)
AFAIK,
Remove-WebConfigurationLockis a part of WebAdministration Module And WebAdministration Module only works for Windows Server 2022 with IIS web role installed. Refer this SO thread answer1 and SO thread answer2 on the same.Also, As per the Octopus Configuration settings, Powershell Core is only supported in the Non Windows machine, Thus you need to check which Worker Pool you are using to run your release. And the
Remove-WebConfigurationLockfailed after selecting Powershell Core and Ubuntu worker too on my end, like below:-As a workaround, You can create a dynamic Worker pool with Windows 2022 server image like below and install the IIS web role in the dynamic Worker pool. Then run your Powershell command. Refer below:-
And then select the above worker pool in your Powershell task and run the below command to first install IIS Web role and then run your command:-
Add below code in Inline Source code:-
Output:-
Above code will also work with Windows- Desktop Powershell along with Powershell Core like above.
Now, After running this command you can use Windows Server Core 2022 worker pool in your Deploy an Azure Web App (Web Deploy) to deploy your package. But according to this official octopus Document on Deploying Azure Web App task. the Task does not contain any setting toi configure Powershell version. Azure web apps | Documentation and Support (octopus.com) . You need to raise a support request with Octopus to get that feature. Also, While creating your web app package, You can use the above method with WindowsAdministration package and then use it in the Deploy Azure Web app step.