如何使用 New-MgGroupOwnerByRef / Microsoft Graph PowerShell 模块 1.1.0 添加组所有者?

How do I add a group owner with New-MgGroupOwnerByRef / Microsoft Graph PowerShell module 1.1.0?

使用Microsoft Graph PowerShell module for groups时,如何添加所有者?没有特定参数 - 命令 New-MgGroupOwnerByRef.

中只有 AdditionalPropertiesBodyParameter

用户 ID - 可以通过 Get-MgUser 获得 - 必须作为 URL 哈希值中的引用 @odata.id:

Connect-MgGraph -Scopes "User.Read.All", "Group.ReadWrite.All"

$group = New-MgGroup -DisplayName "my-new-group" -MailEnabled:$false -mailNickName "my-new-group" -SecurityEnabled

New-MgGroupOwnerByRef -GroupId $group.Id -AdditionalProperties @{"@odata.id"="https://graph.microsoft.com/v1.0/users/a0512e69-7815-4685-b916-e9da762a578f"}

this solution is valid as of version 1.1.0 - in a later release this command maybe enhanced and have a specific parameter for adding owners