actions / runner-images

GitHub Actions runner images
MIT License
10.15k stars 3.06k forks source link

Microsoft.Graph - Replacement of Version 1 with Version 2 #7918

Closed majesticpancake closed 1 year ago

majesticpancake commented 1 year ago

Description

The most recent releases for both the 2019 and 2022 agents have removed version 1.28.0 of the Microsoft.Graph module and replaced it with version 2:

https://github.com/actions/runner-images/releases/tag/win22%2F20230706.1

https://github.com/actions/runner-images/releases/tag/win19%2F20230707.1

Version 2 of this module has only been available for 9 days and contains a number of breaking changes that have necessitated the creation of a migration tool:

https://devblogs.microsoft.com/microsoft365dev/microsoft-graph-powershell-v1-to-v2-migration-toolkit/)

Removing version 1 of the module so quickly seems premature and will cause issues as people have had not yet had time to update their code as required.

Can both modules co-exist on the Windows Server build images for a period of time?

Platforms affected

Runner images affected

Image version and build link

Agent name: 'Azure Pipelines 3'

Agent machine name: 'fv-az786-730'

Current agent version: '3.220.5'

Operating System

Runner Image

Runner Image Provisioner

Current image version: '20230706.1.0'

Is it regression?

No

Expected behavior

PowerShell code using Microsoft.Graph module version 1 will continue to function.

Actual behavior

PowerShell code written for Microsoft.Graph module version 1 which is impacted by the breaking changes in version 2 of the module fails.

Repro steps

  1. Run pipeline with only Version 2 of Microsoft.Graph installed
  2. PowerShell code that has not been updated fails
ilia-shipitsin commented 1 year ago

modules cannot co-exist, moreover, Microsoft.Graph is not allowed to be uninstalled.

I tried the following

Install-Module -Name Microsoft.Graph -RequiredVersion 1.28.0 -Scope CurrentUser -SkipPublisherCheck -allowclobber

seems working for me. can you try in your pipelines ?

Alexey-Ayupov commented 1 year ago

Hello @majesticpancake, according to our policy, we install the latest versions of the next modules. To downgrade the current version you can use this snippet:

    steps:
      - name: downgrade graph
        shell: pwsh
        run: |
          Get-Module -Name Microsoft.Graph* -ListAvailable
          $allmodules = Get-ChildItem -Path "C:\Program Files\WindowsPowerShell\Modules"
          $allmodules | Where-Object {$_.name -match ".graph"} | ForEach-Object {Remove-Item -path $_.FullName -Recurse -force }
          Install-Module -Name Microsoft.Graph -RequiredVersion 1.28.0 -Scope CurrentUser -SkipPublisherCheck -Force
          Get-Module -Name Microsoft.Graph* -ListAvailable
majesticpancake commented 1 year ago

The images have multiple versions of other modules such as the Azure modules, Pester and PowershellGet. Why can't the same be done for the Graph module, especially when the new version is full of breaking changes?