Add-EntraGroupMember

Adds a member to a group.

Syntax

Add-EntraGroupMember
   -GroupId <String>
   -RefObjectId <String>
   [<CommonParameters>]

Description

The Add-EntraGroupMember cmdlet adds a member to a group.

In delegated scenarios, the signed-in user needs a supported Microsoft Entra role or a custom role with the microsoft.directory/groups/members/update permission. The minimum roles required for this operation, excluding role-assignable groups, are:

  • Group owners
  • Directory Writers
  • Groups Administrator
  • User Administrator

Examples

Example 1: Add a member to a group

Connect-Entra -Scopes 'GroupMember.ReadWrite.All'
$group = Get-EntraGroup -Filter "DisplayName eq 'Contoso Marketing Group'"
$user = Get-EntraUser -UserId 'SawyerM@contoso.com'
Add-EntraGroupMember -GroupId $group.Id -RefObjectId $user.Id

This example demonstrates how to add a member to a group.

  • -GroupId - Specifies the unique identifier (Object ID) of the group to which you want to add a member.
  • -RefObjectId - Specifies the unique identifier (Object ID) of the member to be added to the group.

Parameters

-GroupId

Specifies the ID of a group in Microsoft Entra ID.

Type:System.String
Aliases:ObjectId
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-RefObjectId

Specifies the ID of the Microsoft Entra ID object that is assigned as an owner, manager, or member.

Type:System.String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False