Add-EntraGroupOwner
将用户或服务主体添加为Microsoft 365或安全组的所有者。
语法
Default (默认值)
Add-EntraGroupOwner
-GroupId <String>
-OwnerId <String>
[-WhatIf]
[-Confirm]
[<CommonParameters>]
说明
该 Add-EntraGroupOwner cmdlet 将用户或服务主体添加为Microsoft 365或安全组的所有者。 所有者可以修改组。
New-EntraGroupOwner 是 . 的 Add-EntraGroupOwner别名。
在委派方案中,登录用户必须具有受支持的Microsoft Entra角色或具有必要权限的自定义角色。 此操作所需的最低角色为:
- 组所有者
- 用户管理员
- 目录编写人员
- 群组管理员
示例
示例 1:向组添加所有者
Connect-Entra -Scopes 'Group.ReadWrite.All'
$group = Get-EntraGroup -Filter "DisplayName eq 'HelpDesk Team Leaders'"
$user = Get-EntraUser -UserId 'SawyerM@contoso.com'
Add-EntraGroupOwner -GroupId $group.Id -OwnerId $user.Id
此示例演示如何向组添加所有者。
-
-GroupId- 指定要向其添加所有者的组的唯一标识符(对象 ID)。 -
-OwnerId- 指定要添加到组的所有者的唯一标识符(对象 ID)。
参数
-GroupId
指定Microsoft Entra ID中的组的 ID。
参数属性
| 类型: | System.String |
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
| 别名: | 对象标识符 (ObjectId) |
参数集
(All)
| Position: | Named |
| 必需: | True |
| 来自管道的值: | True |
| 来自管道的值(按属性名称): | True |
| 来自剩余参数的值: | False |
-OwnerId
指定要作为组所有者分配的用户或服务主体的对象 ID。
参数属性
| 类型: | System.String |
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
| 别名: | RefObjectId |
参数集
(All)
| Position: | Named |
| 必需: | True |
| 来自管道的值: | True |
| 来自管道的值(按属性名称): | True |
| 来自剩余参数的值: | False |
CommonParameters
此 cmdlet 支持通用参数:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 有关详细信息,请参阅 about_CommonParameters。