Moving AzureAD and MSOnline scripts to Graph or Entra PowerShell

Microsoft is switching off the last legacy access to Azure AD Graph. Here is how to find old AzureAD and MSOnline scripts and move them to Microsoft Graph or Entra PowerShell.

Is there still a script on a server, in Azure Automation or on an admin laptop that starts with Connect-AzureAD or Connect-MsolService? Then now is a good time to rebuild it. This article covers what is being switched off, which successor fits your scripts and how to do the migration.

Why this matters now

Microsoft is shutting down the last legacy access to the Azure AD Graph API. According to Microsoft's announcement, after 6 October 2026 the Microsoft Entra team is gradually removing the remaining legacy first-party access to Azure AD Graph, spread over a two-month buffer period. The announcement does not give an exact end date.

For smaller organisations this can be the nudge to check which scripts are actually still running. A scheduled task a previous admin once set up, a report that counts licences every Monday, a script for new starters: you tend to notice them only when they stop working.

What stops, and what doesn't

Two separate stories tend to get mixed up. Keep them apart.

  • Azure CLI and Azure PowerShell (Az). If you run a current version, you don't need to do anything for the Azure AD Graph retirement. Microsoft's advice is simply to make sure you are on a current, supported version.
  • The standalone AzureAD and MSOnline modules. These are separate from the Az module. They were deprecated earlier and have their own migration path: to the cmdlets of the Microsoft Graph PowerShell SDK, the Microsoft.Graph modules.

For the exact dates on which MSOnline and AzureAD were or will be retired, check the official Microsoft Entra documentation on learn.microsoft.com. For planning purposes it makes little difference: don't build new or updated scripts on these modules.

Two successors: Microsoft Graph PowerShell or Entra PowerShell

In 2021 Microsoft announced that all future PowerShell investment would go into the Microsoft Graph PowerShell SDK. Microsoft Entra PowerShell is part of that investment, and both modules use the latest Microsoft Graph APIs. Entra PowerShell is now generally available.

Microsoft Graph PowerShellMicrosoft Entra PowerShell
DesignCmdlets that stay close to the Graph API, broadly usableDescribed by Microsoft as a scenario-focused module for Entra tasks
Moving from AzureADRewrite scripts to the Microsoft.Graph cmdletsBackward compatibility and aliases make the switch easier
StrengthsAlso useful beyond Entra IDReadable parameters, inline documentation, pipelining support

A rule of thumb:

  • If you have lots of existing AzureAD scripts that mainly manage users, groups and apps in Entra ID, Entra PowerShell is the shortest route.
  • If a script also touches other parts of Microsoft 365, or you are writing something new that goes beyond Entra ID, Microsoft Graph PowerShell is the more natural choice.

You don't have to pick just one. Since version 1.1.0, Entra PowerShell is no longer pinned to Microsoft Graph PowerShell v2.25.0, so you can run the latest Graph modules alongside it.

A quick switch with Entra PowerShell and aliases

This is the example Microsoft gives in its general availability announcement:

Import-Module -Name Microsoft.Entra.Users
Connect-Entra
Enable-EntraAzureADAlias
Get-AzureADUser -Top 1

Connect-Entra replaces Connect-AzureAD. Enable-EntraAzureADAlias turns on aliases, after which an old command such as Get-AzureADUser -Top 1 works.

Treat this as a bridge, not a destination. It buys you time to keep scripts running that would otherwise break. Afterwards, rewrite them properly to the real Entra cmdlets so you don't stay dependent on old names. Test every script after switching: check the output and don't assume everything behaves exactly as before.

Step by step: find, choose, convert, schedule

1. Find everything

Start with an inventory. Look in these places:

  • scheduled tasks on servers and admin workstations;
  • runbooks in Azure Automation;
  • script folders on network shares, in SharePoint or in a Git repository;
  • loose scripts on admins' laptops.

A simple search finds candidates in a script folder:

Get-ChildItem -Path C:\Scripts -Recurse -Include *.ps1 |
  Select-String -Pattern 'Connect-AzureAD|Connect-MsolService|-AzureAD|-Msol' |
  Select-Object Path, LineNumber, Line

On each machine, also check which old modules are still installed with Get-Module -ListAvailable -Name AzureAD, AzureADPreview, MSOnline. For every script, note what it does, who relies on the result, which account it runs under and how often.

2. Choose a route per script

  • Needs to work again quickly and only touches Entra ID: Entra PowerShell with aliases, rewrite later.
  • Broader in scope or due for replacement anyway: go straight to Microsoft Graph PowerShell.
  • Nobody uses it any more: delete it.

3. Convert and test

  • Start with read-only scripts such as reports. Little can go wrong there.
  • Request only the permissions the script really needs. Microsoft Graph uses explicit permissions; pick the smallest set that works.
  • Compare the output with what you see in the Microsoft Entra admin center.
  • Only convert scripts that make changes once the read-only ones run well, and test them on a test user or test group first.

4. Run it on its own identity

Is a scheduled task still running under an employee's account or a Global Administrator? The migration is a good moment to fix that. See run your automations on their own identity, not on a person for how to approach it. If you are rebuilding a report, the article on how to send your device and licence report automatically every month is also worth a look.

5. Keep track of versions

According to Microsoft's release notes, the recommended version of Entra PowerShell is 1.3.0, from May 2026. For servers without internet access, Microsoft added documentation in November 2025 on offline installation using nupkg files and a local repository. Record which module version your scripts use and update on a fixed schedule, so an update doesn't silently break a scheduled task.

Watch out with Azure CLI and Az PowerShell

If you use Azure CLI or the Az module, for example in a build pipeline or to manage Azure resources, check which version is installed on every machine and in every pipeline. According to Microsoft, current versions need no action; the action is aimed at older versions. So update those to a supported version. Don't forget build agents and containers with a pinned version.

What's new in Entra PowerShell in 2026

  • Version 1.2.0 (15 January 2026) added cmdlets for managing Agent Identity Blueprints. Add-EntraBetaClientSecretToAgentIdentityBlueprint adds a client secret that is valid for 90 days. If you use it, plan the renewal too.
  • Version 1.3.0 (May 2026) introduced New-EntraAgentIdentityBlueprint, New-EntraAgentIdentityBlueprintPrincipal, New-EntraAgentIDForAgentIdentityBlueprint and New-EntraAgentUserForAgentId. The last one creates Agent Users with an automatically generated UPN and mailNickname. The dependency on the deprecated AzureAD module was also removed from the build pipeline.

For a typical small business environment, the agent cmdlets are not the priority right now. They do show that Microsoft is actively developing this module, while AzureAD and MSOnline are already deprecated.

Checklist

  • All scripts, scheduled tasks and runbooks using AzureAD or MSOnline cmdlets are on a list.
  • Each script has a decision: Entra PowerShell, Microsoft Graph PowerShell or delete.
  • Read-only scripts are converted and checked against the admin center.
  • Scripts that make changes are tested on a test user or test group.
  • Scheduled tasks run on their own identity with minimal permissions.
  • Azure CLI and Az PowerShell are up to date, including in pipelines.
  • The old modules are removed from servers and workstations.

Would you like someone to help with the inventory or the migration? That falls under IT consultancy. A half-hour intro call is free.

Frequently asked questions

Do I need to do anything if I only use Azure CLI or Az PowerShell?
According to Microsoft, no, as long as you run a current, supported version. Update older versions, including on build agents and in pipelines.
Can I use Entra PowerShell and Microsoft Graph PowerShell side by side?
Yes. Since version 1.1.0, Entra PowerShell is no longer pinned to Microsoft Graph PowerShell v2.25.0, so you can install the latest Graph modules alongside it.
Will my AzureAD scripts work straight away with Entra PowerShell?
Enable-EntraAzureADAlias turns on aliases, after which commands such as Get-AzureADUser work. Still test every script after switching and rewrite it to the Entra cmdlets later.
When exactly do MSOnline and AzureAD stop working?
Check the official Microsoft Entra documentation on learn.microsoft.com for the exact dates. Both modules are already deprecated, so don't build new scripts on them.

This article was written with the help of AI, based on WeMeekIt's hands-on experience.

Book an intro call

Half an hour, free and with no obligation. Pick a time that suits you, and you'll get a confirmation within one business day.

Which day?
What time?
How would you like to meet?
Or call directly: +31 6 39220022