如何使用 Get-MgUserOwnedObject 获取 Microsoft Entra ID 用户拥有的对象

获取 Microsoft Entra ID 用户拥有的对象

管理员需要查看 Microsoft Entra ID 中用户拥有的目录对象,以监控和管理对关键资源的访问,确保用户在角色变更后不再拥有敏感组、Applications Manager 或服务主体的所有权。这有助于防止安全风险,如未经授权的权限提升或孤立对象,影响合规性和治理。

使用 Microsoft Graph PowerShell 获取 Microsoft Entra ID 用户拥有的对象

前提条件

在使用 Get-MgUserOwnedObject 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 (least privileged) to fetch Microsoft Entra ID user-owned objects.
    Connect-MgGraph -Scopes "User.Read.All"

使用 Get-MgUserOwnedObject 命令获取 Microsoft Entra ID 用户拥有的对象

Get-MgUserOwnedObject cmdlet 可用于 Microsoft Graph PowerShell 中获取 Microsoft Entra ID 用户拥有的对象。语法如下:

Get-MgUserOwnedObject
-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-MgUserOwnedObject cmdlet 的示例用例

示例 1:列出特定用户拥有的对象

Get-MgUserOwnedObject -UserId <"user_id"> $userId

在此命令中,将 user_id 替换为您想要列出其用户拥有对象的用户 ID。

支持的参数

下表包含一些可与 Get-MgUserOwnedObject 命令一起使用的参数,以高效获取 Microsoft Entra ID 用户拥有的对象。

参数 描述
-All 此参数检索所有用户拥有的对象,无默认分页限制。
-Filter 此参数根据属性和值筛选用户拥有的对象。
-UserId 此参数根据唯一标识符(如用户主体名称或对象 ID)检索用户拥有的对象。
-Property 此参数检索用户拥有对象的特定属性。
-ConsistencyLevel 启用高级查询功能以提升性能。

使用 Graph PowerShell 脚本获取 Microsoft Entra ID 用户拥有对象的限制

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

使用 ADManager Plus 的亮点

告别复杂的 PowerShell 脚本,使用 ADManager Plus。ManageEngine ADManager Plus 是一款身份治理和管理工具,具有强大的 Microsoft 365 管理和报告功能,可帮助您通过单一、用户友好的控制台执行复杂的管理任务。

  • ADManager Plus 具有直观界面,简化报告生成过程。
  • 提供全面且可定制的报告,并支持安排和自动生成报告。
  • 它支持即时管理操作,即时管理用户
  • 针对大规模环境进行了优化,无需任何脚本即可进行批量操作。
  • Delegate tasks 给技术人员,无需提升其本地权限。
  • 利用超过 200 个预置报告,密切监控您的 IT 环境。
  • 允许以多种格式导出报告,如 CSV 或 HTML,仅需几次点击。

告别 PowerShell 的麻烦,使用 ADManager Plus 轻松管理 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