Powershell version in github action

All,

I am currently trying to run some latest az module commands that require powershell 5.0x. I have mentioned powershell in the shell command as mentioned below. While looking at the logs, it looks like it is using powershellv1 instead of 5. Can somebody guide me here

  • name: look for ps1 file
    shell: powershell
    run: |
    .\FrontDoorReport.ps1 -STORAGE_ACCOUNT_KEY ${{ secrets.STORAGE_ACCOUNT_KEY }} - }}

Hi @SaraAhmad944,

Glad to see you in Github Community Forum!

The default powershell on windows-latest hosted runer is verision 5.1 not v1.
image

If you’d like to choose custom shell for your command, please check the guide here for the details.

And here’s an existing sample of az command action, please the the link for your reference.

Hope it helps!

Hi @SaraAhmad944,

Based on your error message, it should be due to the module is not imported while not the PS version.
You can always get a listing of the available modules using below command for confirmation.

Get-Module -ListAvailable

Please try to import the module(Install-Module -Name Az.FrontDoor -force), let me know if it works for you.

Thanks.