Powershell 7/Core in WebApp

Product: PowerShell Universal
Version: 1.5.13

I’ve used the Azure WebApp Github Action repo to install Universal in Azure and wanted to know how to get Powershell Core/7 installed?

Any ideas or leads appreciated

You should be able to download the PS7 ZIP from GitHub and extract it to the web app.


Maybe update the download.ps1 file with something like:

Invoke-WebRequest "https://github.com/PowerShell/PowerShell/releases/download/v7.1.2/PowerShell-7.1.2-win-x64.zip" -OutFile ".\ps7.zip"
Expand-Archive -Path .\ps7.zip -DestinationPath .\ps7

The other thing you may need to do it is add that path to the $Env:PATH variable so Universal can find the PS7 executable automatically. You could also add the custom path via Environments in PSU.

Thanks Adam, I’ve done basically what you suggested already by uploading an extracted version of that zip to D:\Home as well as under D:\home\wwwroot\ps7.

I added both paths via Environments in PSU, created a new dashboard but when clicking start it attempts to start for quite a while before stopping.

I’ve added pwsh to the application settings, no luck when trying to call pwsh in PSU Environment

You mention setting the #ENV:Path variable, do i need to do that as described here

setting the webapp %PATH% environment variable in azure - Stack Overflow

Where are the logs stored in this environment so I can look for clues?

Bummer. Thought that would work.

Logs will depend on your Azure Web App settings but you should be able to view them in the log stream.

You shouldn’t have to set the $ENV:Path variable if you have put the full path to pwsh.exe. The other thing you could try to do is open the Azure Kudu Tools and attempt launch pwsh.exe from within the terminal there. That might give you an error message as to why it’s not starting properly.

Yeah it’s a bummer :frowning:

I have put it in the default path and can launch it from any folder manually using pwsh and then check the processes and see it momentarily. No joy using it within PU.

Tried the same with 32bit, get a dll

The other way to accomplish this is to use a Docker Web App. We have a Windows Server Core image that contains PS7. Docker web apps are kinda their own beast though.

1 Like

@adam I’m resurrecting this old thread since you’ve done so much to make PSU more “Azure friendly” over the past 18 months.

I want to try using different PSU environments, but like @MaCCa I have found that my Azure App Service does not come with “pwsh.exe”.

Have you had any thoughts on how we can make this work? Or is there perhaps a way (and I know this sounds dumb) to use the “integrated” environment but have it spin off a new process so we get the best of both worlds?

Edit: After a bit of back and forth with friends on Twitter and some Googling, the best I can come up with is running dotnet tool install --global PowerShell from the Init.ps1 script. But I’ll wait for feedback here before I try anything like that. Also I’m not sure how that would react when PSU restarts and it tries to install an already-installed PowerShell. Hoping there’s a better way.


Init.ps1 would likely be the best way to accomplish this in PSU. You could just check for the existence of pwsh.exe on startup to avoid any issues if it’s already installed.

$pwsh = Get-Command pwsh -ErrorAction SilentlyContinue
if (-not $pwsh)
   dotnet tool install --global PowerShell

I’ve never used them before but site extensions seem like they are intended for something like this. For example, you can add particular runtimes to your site.

That said, a PowerShell one does not exist and the docs are hard to find on how to publish a new extension.

1 Like