Home Tip of the day – Start Moving Microsoft Graph PowerShell Scripts to PowerShell 7
Post
Cancel

Tip of the day – Start Moving Microsoft Graph PowerShell Scripts to PowerShell 7

Tip

If your Microsoft Graph automation still runs on Windows PowerShell 5.1, start planning the move to PowerShell 7.x now.

Microsoft announced a 12-month retirement period for Windows PowerShell 5.x support in the Microsoft Graph PowerShell modules. This is a maintenance transition, not an immediate breaking change:

  • The current v2.x modules remain compatible with Windows PowerShell 5.1 during the transition.
  • New development, validation, and bug fixes are moving to PowerShell 7.x and later.
  • Microsoft plans to release Microsoft Graph PowerShell v3.0.0 in Q4 2026.
  • v3.x will be supported on PowerShell 7.x and will not have explicit Windows PowerShell 5.x support.

Check your current version

Add a quick check to your migration inventory:

1
2
3
4
$PSVersionTable.PSVersion
Get-Module Microsoft.Graph* -ListAvailable |
    Sort-Object Version -Descending |
    Select-Object -First 10 Name, Version, Path

If the PowerShell version starts with 5.1, identify the scripts, scheduled tasks, Azure Automation jobs, and deployment pipelines that use Microsoft Graph.

Test with PowerShell 7

Install the current PowerShell 7 release through your organization’s approved software channel, then run a representative script with pwsh:

1
pwsh -File .\Export-GraphInventory.ps1

Check the areas most likely to expose differences:

  • Module installation and import
  • Authentication and interactive login
  • Managed identity or certificate authentication
  • File-system paths and encoding
  • Scheduled task or pipeline runners
  • CSV, JSON, and date/time output
  • SharePoint and Microsoft Graph permissions

Keep the v2.x modules in place while you validate your scripts. The goal is to move the runtime first, then plan the module upgrade when v3 is available and your compatibility testing is complete.

I would migrate in two stages: first run the existing v2 scripts under PowerShell 7, then evaluate the Graph PowerShell v3 module separately when it is available. Splitting the runtime and module changes makes failures much easier to diagnose.

Windows PowerShell 5.1 is not being switched off today. The announcement describes a planned retirement of active maintenance, so use the transition period to migrate rather than waiting for v3.

References

Image Prompt

1
Wide horizontal blog banner, 40:21 aspect ratio. Flat illustration of two developers collaborating at a desk, one reviewing an older script while the other tests it in a modern PowerShell 7 environment. Dark blue background with cyan, green, and amber highlights. People and screens centered with safe space around them. No readable text, no logos. --ar 40:21 --style raw
This post is licensed under CC BY 4.0 by the author.

SPFx Dev Skills: Give AI Coding Agents the Right SharePoint Toolchain

Tip of the day – Choose the Right Copilot Component Display Mode