The report doesn’t run. That’s how you find out.
It’s a Monday, the access-review export that lands in the compliance team’s inbox every week simply isn’t there, and someone pings you at 9:15 asking where it went. You open the scheduled task, click Run, and watch it fail in real time. The error isn’t a permissions problem or an expired secret. It’s uglier and more fundamental than that:
If you’ve run Microsoft.Graph on Windows PowerShell 5.1 for any length of time, you already know this error. It’s the one that shows up when two modules each drag in a different version of the same .NET assembly, and the runtime, having loaded one already, refuses to load the other. There is no clever -Force that fixes it. The engine is holding a part it won’t put down.
This is the failure Microsoft has now decided to stop patching around. Windows PowerShell 5.1 support in the Microsoft Graph PowerShell SDK is being retired. No firm date has been given, and I’ll come back to why that vagueness is its own hazard, but the direction is set. Let me walk through exactly what breaks, why, and how to make sure the failing scheduled task on some future Monday isn’t yours.
Why 5.1 was always the wrong engine for this car
Here’s the analogy I keep reaching for. Windows PowerShell 5.1 is a beautifully engineered engine built for one specific fuel: the .NET Framework, the version that shipped inside Windows and gets updated on Windows’ schedule. PowerShell 7 runs on .NET (formerly .NET Core), which is cross-platform, side-by-side, and moves fast.
The Graph SDK is a large, fast-moving car. It’s really a thousand generated cmdlets sitting on top of the Graph API, and it pulls in a stack of modern .NET dependencies to do its job, auth libraries, JSON serialisers, HTTP handlers. Those dependencies expect the new fuel.
For years Microsoft kept the old engine running on the new fuel with careful shimming. The assembly-loading conflicts were the visible symptom of that mismatch: 5.1 has a single shared load context, so if anything in your session, another module, a profile script, a leftover Az assembly, already loaded a given DLL, Graph couldn’t load its own version. PowerShell 7 has assembly load contexts that isolate this. The new engine simply doesn’t have the problem.
So the retirement isn’t Microsoft being capricious. It’s the maintenance team looking at the shim, looking at the bug reports, and deciding the effort is better spent elsewhere. Maintenance burden, dependency conflicts, assembly-loading challenges, that’s the stated reasoning, and having debugged that exact error at 11 p.m., I believe every word of it.
What actually stops working
Be clear about the blast radius, because it’s easy to over- or under-read it.
What breaks: the Microsoft.Graph module (and the SDK sub-modules like Microsoft.Graph.Authentication) loading inside Windows PowerShell 5.1. Once support is enforced, Connect-MgGraph won’t authenticate, and every downstream cmdlet, user and group provisioning, Conditional Access policy updates, sign-in and audit reporting, license assignment, goes down with it, because they all sit on that one authentication module. It’s not a graceful degradation. The import fails, and nothing built on it runs.
What does not break: the Graph API itself is untouched. Azure CLI is untouched. Your Logic Apps, your Power Automate flows, anything calling Graph over HTTPS directly, all fine. This is specifically about the PowerShell SDK refusing to load in the 5.1 runtime. Same cmdlets, same API, wrong engine.
The nasty part is the “no firm date.” You can’t put a reminder in your calendar for a deadline that doesn’t exist. It’ll arrive as a module version bump, you’ll do a routine Update-Module Microsoft.Graph, or an Automation account will pull the latest, and the new build simply won’t support 5.1 anymore. If your CI has ever auto-updated a module, you know exactly how that morning goes.
Find every place 5.1 is still driving
You can’t migrate what you can’t see. Start with the running session, then hunt the automation. These are read-only; run them and read before you touch anything.
The first check is the one everyone knows and half of us forget:
Now the part that actually finds the landmines, scheduled tasks. A task calling powershell.exe runs on 5.1; one calling pwsh.exe runs on 7. Enumerate them and flag the legacy engine:
Then grep your script estate for anything importing or connecting to Graph, so you know which files need to run under 7:
Don’t forget the estate you don’t log into by hand: Azure Automation runbooks (check whether they’re set to the 5.1 or 7 runtime version), any Hybrid Runbook Workers, build agents, and that one jump box in the corner that everyone forgot owns three critical tasks.
Migrate the engine, not the car
Here’s the genuinely good news, and the reason this is a migration and not a rewrite. The cmdlets don’t change. Get-MgUser, New-MgGroup, Update-MgIdentityConditionalAccessPolicy, identical syntax, identical parameters, same behaviour. You are swapping the engine under the same car. In most scripts the only mechanical change is the shebang and the invocation: pwsh instead of powershell.exe.
Install PowerShell 7 side by side, it does not remove or replace 5.1, they coexist happily, then install the SDK into the 7 scope:
Test against reality before you cut over, and never let a state-changing script run for the first time without a dry run. Pipe reviewed input in, and keep -WhatIf on by default:
For paginated reads, let the SDK do the work with -All rather than hand-rolling $top loops, it handles the @odata.nextLink paging for you:
Run old and new side by side for a cycle or two. Point the 5.1 task and a cloned 7 task at the same job, compare outputs, and only then repoint the schedule to pwsh and disable the old one. Keep the disabled task around for a fortnight as a rollback.
The story that started this, the missing report, the assembly error, the 9:15 ping, is the story that plays out for whoever does nothing. Pull the lessons out and it’s short:
- “No date” is a worse deadline than a date. It arrives silently, as a module update, on a morning of the module’s choosing. Migrate on your schedule so it never gets to pick yours.
- The blast radius is the auth module. Everything routes through
Connect-MgGraph; when it can’t load under 5.1, provisioning, Conditional Access, licensing and reporting all stop together. - This is an engine swap, not a rewrite. The cmdlets are identical. Most scripts need
pwshinstead ofpowershell.exeand nothing more. - Audit the automation you never log into. Runbooks, hybrid workers, build agents, the forgotten jump box, that’s where 5.1 hides.
- Prove it before you cut over. Side-by-side runs,
-WhatIfon by default, reviewed input files, a disabled old task as your parachute.
The engine that got you here won’t take the new fuel. Change it while the car’s in the garage, not on the motorway.
