Get-EntraGroupOwner

获取组的所有者。

语法

Default (默认值)

Get-EntraGroupOwner

    -GroupId <String>
    [-All]
    [-Top <Int32>]
    [-Property <String[]>]
    [<CommonParameters>]

说明

Get-EntraGroupOwner cmdlet 获取Microsoft Entra ID中的组的所有者。 指定 GroupId 参数获取组的所有者。

在委派方案中,登录用户必须具有受支持的Microsoft Entra角色或具有权限的microsoft.directory/groups/owners/read自定义角色。 以下最低特权角色支持此操作:

  • 组所有者
  • 目录读取器
  • 目录编写人员
  • 群组管理员
  • 用户管理员

示例

示例 1:按 ID 获取组所有者

Connect-Entra -Scopes 'GroupMember.Read.All'
$group = Get-EntraGroup -Filter "DisplayName eq 'Sales and Marketing'"
Get-EntraGroup -GroupId $group.Id | Get-EntraGroupOwner | Select-Object Id, DisplayName, '@odata.type'
Id                                   DisplayName       @odata.type
------------------------------------ ----------------- -------------------------------
dddddddd-3333-4444-5555-eeeeeeeeeeee Sawyer Miller     #microsoft.graph.user
eeeeeeee-4444-5555-6666-ffffffffffff Alex Wilber       #microsoft.graph.user

此示例演示如何检索特定组的所有者。

  • -GroupId 参数指定组的 ID。

示例 2:获取所有组所有者

Connect-Entra -Scopes 'GroupMember.Read.All'
$group = Get-EntraGroup -Filter "DisplayName eq 'Sales and Marketing'"
Get-EntraGroupOwner -GroupId $group.Id -All | Select-Object Id, DisplayName, '@odata.type'
Id                                   DisplayName       @odata.type
------------------------------------ ----------------- -------------------------------
dddddddd-3333-4444-5555-eeeeeeeeeeee Sawyer Miller     #microsoft.graph.user
eeeeeeee-4444-5555-6666-ffffffffffff Alex Wilber       #microsoft.graph.user

此示例演示如何检索特定组的所有所有者。

  • -GroupId 参数指定组的 ID。

示例 3:获取两个组所有者

Connect-Entra -Scopes 'GroupMember.Read.All'
$group = Get-EntraGroup -Filter "DisplayName eq 'Sales and Marketing'"
Get-EntraGroupOwner -GroupId $group.Id -Top 2 | Select-Object Id, DisplayName, '@odata.type'
Id                                   DisplayName       @odata.type
------------------------------------ ----------------- -------------------------------
dddddddd-3333-4444-5555-eeeeeeeeeeee Sawyer Miller     #microsoft.graph.user
eeeeeeee-4444-5555-6666-ffffffffffff Alex Wilber       #microsoft.graph.user

此示例演示如何检索特定组的前两个所有者。 您可以将 -Limit 用作 -Top 的别名。

  • -GroupId 参数指定组的 ID。

参数

-All

列出所有页面。

参数属性

类型:System.Management.Automation.SwitchParameter
默认值:False
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-GroupId

指定Microsoft Entra ID中的组的 ID。

参数属性

类型:System.String
默认值:None
支持通配符:False
不显示:False
别名:对象标识符 (ObjectId)

参数集

(All)
Position:Named
必需:True
来自管道的值:True
来自管道的值(按属性名称):True
来自剩余参数的值:False

-Property

指定要返回的属性。

参数属性

类型:

System.String[]

默认值:None
支持通配符:False
不显示:False
别名:Select

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Top

指定要返回的最大记录数。

参数属性

类型:System.Int32
默认值:None
支持通配符:False
不显示:False
别名:Limit

参数集

(All)
Position:Named
必需:False
来自管道的值:True
来自管道的值(按属性名称):True
来自剩余参数的值:False

CommonParameters

此 cmdlet 支持通用参数:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 有关详细信息,请参阅 about_CommonParameters