Azure / powershell

GH Action to run Az PowerShell scripts for developers and administrators to develop, deploy, and manage Microsoft Azure applications.
MIT License
60 stars 40 forks source link

When us the AzPSVersion: latest flag Az version 9 is used instead of version 11 #94

Closed NickSt closed 10 months ago

NickSt commented 10 months ago

the latest flag does not seem to use the latest version of the az ps module. It produces a warning on each running stating version 9 is being ran.

YanaXu commented 10 months ago

Hi @NickSt , could you provide the sample workflow file, debug log and details about your runners? Do you use a self-hosted runner or a GitHub-hosted runner?

NickSt commented 10 months ago

Hi YanaXu

Using github-hosted runners

The job looks like this:

jobs:
  build:
    name: Build
    runs-on: windows-latest
    environment: <customID>
    steps:
    - name: Checkout Repo
      uses: actions/checkout@v4

    - name: Azure Login
      uses: azure/login@v1
      with:
        creds: ${{ secrets.AZURE_CREDENTIALS_PRIMARY }}
        enable-AzPSSession: true

    - name: Setup .NET
      uses: actions/setup-dotnet@v3
      with:
        dotnet-version: ${{ env.DOTNET_VERSION }}

    - name: Setup MSBuild
      uses: microsoft/setup-msbuild@v1

    - name: Calculate Variables
      id: data
      shell: pwsh
      run: |
            <script stuff here>

    - name: Build
      uses: azure/powershell@v1
      with: 
        inlineScript: <script runs here>
        azPSVersion: latest
        failOnStandardError: true

Note I also get a warning about AzureRM being installed which I believe is from the Azure/Login action, but they are both required I think and most examples I've found show Azure/Login and Azure/Powershell being used together.

YanaXu commented 10 months ago

@NickSt , the latest azPSVersion actually means the pre-installed Az module version on the GitHub-hosted runners, which is 9.3.0. Before it's upgraded to the latest one on PSGallery, could you update your workflow file to use like azPSVersion: 11.0.0?

YanaXu commented 10 months ago

@NickSt , I'll close this issue now. Please feel free to reopen it if you still have questions on this.