Add-EntraDirectoryRoleMember

Adds a member to a directory role.

Syntax

Add-EntraDirectoryRoleMember
   -DirectoryRoleId <String>
   -RefObjectId <String>
   [<CommonParameters>]

Description

The Add-EntraDirectoryRoleMember cmdlet adds a member to a Microsoft Entra ID role.

Examples

Example 1: Add a member to a Microsoft Entra ID role

Connect-Entra -Scopes 'RoleManagement.ReadWrite.Directory'
$params = @{
    DirectoryRoleId = '67efd1ad-1046-4fb8-bb57-1d2e4f66c74e'
    RefObjectId = 'bbbbbbbb-1111-2222-3333-cccccccccccc'
}
Add-EntraDirectoryRoleMember @params

This example adds a member to a directory role.

  • DirectoryRoleId parameter specifies the ID of the directory role to which the member is added. Use the Get-EntraDirectoryRole command to retrieve the details of the directory role.
  • RefObjectId parameter specifies the ID of Microsoft Entra ID object to assign as owner/manager/member.

Parameters

-DirectoryRoleId

Specifies the ID of a directory role 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 to assign as owner/manager/member.

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