Support
 
PhoneGet Quote
 
Support
 
US Sales: +1 888 720 9500
US Support: +1 844 245 1108
Intl: +1 925 924 9500
Aus: +1 800 631 268
UK: 0800 028 6590
CN: +86 400 660 8680

Direct Inward Dialing: +1 408 916 9890

 
 
Your AzureAD PowerShell commands are deprecated! Here's how to keep your scripts functional
Microsoft 365 News

Your AzureAD PowerShell commands are deprecated! Here's how to keep your scripts functional

Posted on Apr 04, 2025
Written by Ashwin Kumar
 
On this page
  • Why and when were AzureAD and MSOnline PowerShell modules deprecated?
  • What are the benefits Microsoft Graph offers over AzureAD PowerShell?
  • How to migrate from AzureAD PowerShell to Microsoft Graph PowerShell
  • Limitations of Microsoft Graph PowerShell and how to overcome them
  • Get a clear overview of your Microsoft 365 administration with M365 Manager Plus

Starting on March 31, 2025, Microsoft's AzureAD and MSOnline PowerShell modules will be deprecated completely, rendering popular and existing cmdlets useless. However, there are replacements for your scripts and your hard work. The official solution from Microsoft is to migrate to the Graph PowerShell SDK, a modern rendition of the deprecated modules.

In this blog, we will check out the reason behind this deprecation, how to migrate to the new Microsoft Graph PowerShell module, where you can find commonly used Microsoft Graph PowerShell cmdlets, and how there's a better alternative to scripting for your routine tasks and automations.

Why and when were AzureAD and MSOnline PowerShell modules deprecated?

Microsoft has set March 31, 2025, as the final date for support of the AzureAD PowerShell and MSOnline PowerShell modules. This deprecation is intended to consolidate functionalities spread across multiple services and APIs under the Microsoft Graph framework.

By retiring older modules in favor of Microsoft Graph PowerShell SDK, Microsoft ensures administrators have access to a single, modern, and continually updated API layer for identity and Microsoft 365 services—bringing together improved features, consistent authentication, more granular permissions, and overall future-proofing of automation and scripting scenarios.

What are the benefits Microsoft Graph offers over AzureAD PowerShell?

Apart from the extended support offered for GraphAPI, there are other benefits to switching over from AzureAD PowerShell:

  1. Unified endpoint for all services: Microsoft Graph provides a single endpoint (graph.microsoft.com) to interact with a wide range of Microsoft 365 services rather than relying on separate APIs or cmdlets for each service. This consolidation simplifies development, reduces the need to learn multiple APIs, and allows for more coherent and streamlined automation.
  2. Integration in Entra Applications: Having a REST-based API and robust SDK support means that Microsoft Graph integrates more easily into modern DevOps pipelines. Scripts or applications can call the API directly, enabling smoother processes for identity-related tasks and other Microsoft 365 automation scenarios.
  3. Granular permission management: Instead of granting wide-ranging permissions to a script or user, Microsoft Graph lets you choose between delegated (on behalf of a signed-in user) or application permissions. You can assign fine-tuned scopes to your sessions. For example, User.Read to retrieve basic user profile information. This makes it simpler to stay aligned with the principles of least privilege and revoke any unneeded permissions for the specific session.

How to migrate from AzureAD PowerShell to Microsoft Graph PowerShell

Since the AzureAD and MSOnline PowerShell modules will not work beginning on March 31, 2025, you will have to install the Microsoft Graph PowerShell module and use new cmdlets to keep your existing management and automation scripts up and running.

You can install the Microsoft Graph PowerShell module by following these steps:

  • Run this cmdlet in Windows PowerShell as an administrator: Install-Module Microsoft.Graph -Scope CurrentUser
  • You will be prompted to sign in to Microsoft 365. Sign in with the credentials of the user accounts whose permissions you want the module to use.
  • When prompted, enter Y to proceed.

Once installed, run Connect-MgGraph to connect to the Microsoft Graph module.

Most of the Microsoft Graph PowerShell cmdlets are derivatives of existing AzureAD PowerShell cmdlets, albeit with a different prefix. For example, New-AzureADUser is replaced with New-MgUser; Get-AzureADUser is replaced with Get-MgUser; and Set-AzureADUser is replaced with Update-MgUser.

Start your Microsoft Graph PowerShell journey with some of the widely-used cmdlets linked below:

If you wish to just get a list of all new cmdlets, you can refer to Microsoft's guide on migrating to GraphAPI.

Limitations of Microsoft Graph PowerShell and how to overcome them

While the migration from AzureAD PowerShell to Microsoft Graph PowerShell is a vast improvement in security and granularity, it still inherits most of AzureAD PowerShell's flaws and drawbacks. Some of them include:

  • Assigning granular permissions to execute individual tasks, such as only allowing an admin to delete users, is still not possible.
  • The export process requires multiple manual steps with numerous parameters, and involves setting up custom filters or formats each time—making it long and tedious.
  • Some bulk operations, such as modifying public folders, are still not possible.
  • Only users familiar with Microsoft Graph PowerShell can come up with the relevant commands and edit them to fit their organizational needs.
  • Reports will have to be filtered every time they are generated, and the filters cannot be saved. This can be inefficient if a filter is required to generate data that you require frequently.

Relying on Microsoft Graph PowerShell scripts can be time consuming and prone to errors. If you wish to overcome these obstacles in your day-to-day Microsoft 365 administration, ManageEngine's M365 Manager Plus might be what you need!

Get a clear overview of your Microsoft 365 administration with M365 Manager Plus

ManageEngine M365 Manager Plus is a comprehensive administration and security solution used for reporting, managing, monitoring, auditing, and creating alerts for critical activities in your Microsoft 365 environments.

Easily manage users, groups, contacts , mailboxes, teams, and sites in bulk without Graph PowerShell scripting. Automate repetitive tasks in Microsoft 365—such as user provisioning, group cleanups, site management, and more—with a no-code approach to save time and minimize errors in your lifecycle management processes.

You can also gain a thorough understanding of your environment—not just in Microsoft Entra ID, but also Exchange Online, SharePoint Online, OneDrive for Business, and other Microsoft 365 services—with detailed reports and intuitive visualizations, all from a single console. You can also create data filters and save them as custom reports that you can access in just a few clicks.

There are even more benefits to using M365 Manager Plus to manage and monitor your Microsoft 365 environment:

More blogs like this

Thumbnail Microsoft 365 News

End of support for Exchange Server 2016 and 2019: Here's what you can do about it!

 
Thumbnail Best practices

Top 10 Microsoft Entra ID reports every admin should track daily

 
Thumbnail Best practices

10 ways to level up your Entra ID management

 
 
A holistic Microsoft 365 administration and security solution