如何使用 Get-MgUserDirectReport 获取 Microsoft Entra ID 中用户的直接下属

获取 Microsoft Entra ID 中用户的直接下属

IT 管理员经常需要查找用户的直接下属以满足合规和审计需求。虽然 Graph PowerShell 的 Get-MgUserDirectReport 命令(Get-AzureADUserDirectReport 命令的替代方案)可用于获取并导出 Microsoft Entra ID 中用户的直接下属,但其复杂且不直观的界面使其成为一个具有挑战性的选项。另一方面,ADManager Plus 作为一个 Microsoft 365 管理和报告工具,简化了这一过程,使管理员能够仅需几次点击即可快速生成并导出用户的直接下属。

  • ADManager Plus
  • PowerShell
 

使用 ADManager Plus 列出 Microsoft Entra ID 中用户的直接下属

  1. 登录 ADManager Plus 并导航至 Microsoft 365 > Reports > User Reports
  2. General User Reports 下,点击 Microsoft 365 Users
  3. Microsoft Tenant 下拉列表中选择所需的 Microsoft 365 租户。
  4. Filter By 弹出窗口中选择您想要获取用户的目标组或域,然后点击 Generate
  5. 用户的直接下属可在 Direct Reports 列中找到。
使用 ADManager Plus 预定义报告获取 Microsoft Entra ID 中用户的直接下属
 
 

以多种格式导出报告,包括 HTML、CSV 和 PDF。

 
 

安排自动生成报告。

使用 Microsoft Graph PowerShell 获取 Microsoft Entra ID 中用户的直接下属

前提条件

在使用 Get-MgUserDirectReport cmdlet 之前,请确保以下事项:

  • The Microsoft Graph PowerShell module is installed. If not, install it using this script:
    Install-Module Microsoft.Graph -Scope CurrentUser
  • Connect to Microsoft Graph PowerShell with the required permissions to fetch a user's direct reports in Microsoft Entra ID with this script:
    Connect-MgGraph -Scopes "User.Read.All"

使用 Get-MgUserDirectReport 命令获取 Microsoft Entra ID 中用户的直接下属

Get-MgUserDirectReport cmdlet 可用于 Microsoft Graph PowerShell 中获取 Microsoft Entra ID 中用户的直接下属。语法如下:

Get-MgUserDirectReport
-UserId <String>
[-ExpandProperty <String[]>]
[-Property <String[]>]
[-Filter <String>]
[-Search <String>]
[-Skip <Int32>]
[-Sort <String[]>]
[-Top <Int32>]
[-ConsistencyLevel <String>]
[-ResponseHeadersVariable <String>]
[-Headers <IDictionary>]
[-PageSize <Int32>]
[-All]
[-CountVariable <String>]
[-ProgressAction <ActionPreference>]
[<CommonParameters>]

使用 Get-MgUserDirectReport cmdlet 的示例用例

列出特定用户的所有直接下属

Get-MgUserDirectReport -UserId <'user_id'>

在此命令中,将 user_id 替换为您想要列出所有直接下属的用户 ID。

支持的参数

下表包含一些可与 Get-MgUserDirectReport 命令一起使用的参数,以高效获取 Microsoft Entra ID 中用户的直接下属。

参数 描述
-All 此参数检索用户的所有直接下属,无默认分页限制。
-Filter 此参数根据属性和值过滤用户的直接下属。
-UserId 此参数根据唯一标识符(如用户主体名称或对象 ID)检索用户的直接下属。
-Property 此参数检索用户直接下属的特定属性。

使用 Graph PowerShell 脚本获取 Microsoft Entra ID 中用户直接下属的限制

  • Graph PowerShell 要求 IT 管理员从 Azure AD PowerShell 升级并熟悉 PowerShell 脚本。
  • Microsoft Graph API 实施了限制策略,可能会影响批量获取用户直接下属时的性能。
  • 脚本可能需要额外工作来格式化和导出数据以用于报告。
  • 需要技术专长来排查错误。
  • 缺乏直观界面使整体体验不够友好,尤其对脚本新手而言。

使用 ADManager Plus 获取 Microsoft Entra ID 中用户直接下属的亮点

  • 直观的界面简化报告生成流程。
  • 提供全面且可自定义的报告,支持计划和自动生成报告。
  • 支持即时执行管理操作以 manage users
  • 针对大规模环境优化,无需任何脚本即可进行批量操作。
  • Delegate tasks 给技术人员,无需提升其本地权限。
  • 通过超过 200 pre-packaged reports 密切监控您的 IT 环境。
  • 只需几次点击即可将报告导出为 CSV 或 HTML 等多种格式。

使用 ADManager Plus 轻松获取 Microsoft Entra ID 中用户的直接下属

 
  • 使用 ADManager Plus 获取 Microsoft Entra ID 中用户的直接下属
  • 使用 Microsoft Graph PowerShell 获取 Microsoft Entra ID 中用户的直接下属
  • 使用 Graph PowerShell 脚本获取 Microsoft Entra ID 中用户直接下属的限制
  • 使用 ADManager Plus 获取 Microsoft Entra ID 中用户直接下属的亮点
Active Directory管理与报告的一站式解决方案
电子邮件下载链接 Email the ADManager Plus download link