Add-EntraBetaDirectoryRoleMember
Adds a member to a directory role.
Syntax
Add-EntraBetaDirectoryRoleMember
-DirectoryRoleId <String>
-MemberId <String>
[<CommonParameters>]
Description
The Add-EntraBetaDirectoryRoleMember
cmdlet adds a member to a Microsoft Entra ID role.
In delegated scenarios, the signed-in user must have either a supported Microsoft Entra role or a custom role with the necessary permissions. The minimum roles required for this operation are:
- Privileged Role Administrator
Examples
Example 1: Add a member to a Microsoft Entra ID role
Connect-Entra -Scopes 'RoleManagement.ReadWrite.Directory'
$directoryRole = Get-EntraBetaDirectoryRole -Filter "DisplayName eq 'Helpdesk Administrator'"
$user = Get-EntraBetaUser -UserId '[email protected]'
Add-EntraBetaDirectoryRoleMember -DirectoryRoleId $directoryRole.Id -MemberId $user.Id
This example adds a member to a directory role.
DirectoryRoleId
parameter specifies the ID of the directory role to which the member will be added. Use theGet-EntraBetaDirectoryRole
command to retrieve the details of the directory role.MemberId
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 |
-MemberId
Specifies the ID of the Microsoft Entra ID object to assign as owner/manager/member.
Type: | System.String |
Aliases: | RefObjectId |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |