As Microsoft continues the shift away from the AzureAD module, administrators need to migrate their scripts to use the Microsoft Graph PowerShell SDK. One such migration involves replacing Get-AzureADUserDirectReport—a cmdlet used to list users who report to a manager—with the Graph-based alternative: Get-MgUserDirectReport
In this article, we’ll show you how to switch from Get-AzureADUserDirectReport to Get-MgUserDirectReport, highlight the differences, and provide real-world examples to make your transition seamless.
The Get-AzureADUserDirectReport cmdlet was used to list all users who directly reported to a specific manager. You could reference the manager by their UPN or ObjectId.
Get-AzureADUserDirectReport -ObjectId "samadmin@7xh7fj.onmicrosoft.com"
This would return a list of users who were listed as direct reports under the specified manager in Azure AD.
The modern Graph-based equivalent is:
Get-MgUserDirectReport -UserId "samadmin@7xh7fj.onmicrosoft.com"
This cmdlet can also accept a user’s GUID (ObjectId) instead of the UPN:
Get-MgUserDirectReport -UserId "1111-2222-3333-4444"
The -UserId parameter accepts both UPN (UserPrincipalName) and GUID, giving you flexibility in scripting.
Old (Get-AzureADUserDirectReport) | New (Get-MgUserDirectReport) |
Parameter name: -ObjectId | Parameter name: -UserId |
Part of AzureAD module (deprecated) | Part of Microsoft.Graph.Users module |
Returns basic info about direct reports | Returns Microsoft Graph directory objects |
No longer maintained | Fully supported and actively updated |
If you want to fetch additional properties of the direct reports (like display name, job title, etc.), you can combine with Get-MgUser or use Graph PowerShell Expand Property for richer queries.
Migrating from Get-AzureADUserDirectReport to Get-MgUserDirectReport is simple, but vital for keeping your directory reporting scripts Graph-compliant and future-ready. The Graph SDK provides better performance, consistent object formatting, and works seamlessly across all Microsoft 365 workloads.
Start using Get-MgUserDirectReport today and modernize your reporting workflows!
© Your Site Name. All Rights Reserved. Design by HTML Codex