Add-EntraDirectoryRoleMember
Adds a member to a directory role.
Syntax
Default (Default)
Add-EntraDirectoryRoleMember
-DirectoryRoleId <String>
-MemberId <String>
[<CommonParameters>]
Description
The Add-EntraDirectoryRoleMember 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-EntraDirectoryRole -Filter "DisplayName eq 'Helpdesk Administrator'"
$user = Get-EntraUser -UserId 'SawyerM@Contoso.com'
Add-EntraDirectoryRoleMember -DirectoryRoleId $directoryRole.Id -MemberId $user.Id
This example adds a member to a directory role.
DirectoryRoleIdparameter 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.MemberIdparameter 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.
Parameter properties
| Type: | System.String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | ObjectId |
Parameter sets
(All)
| Position: | Named |
| Mandatory: | True |
| Value from pipeline: | True |
| Value from pipeline by property name: | True |
| Value from remaining arguments: | False |
-MemberId
Specifies the ID of the Microsoft Entra ID object to assign as owner/manager/member.
Parameter properties
| Type: | System.String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | RefObjectId |
Parameter sets
(All)
| Position: | Named |
| Mandatory: | True |
| Value from pipeline: | True |
| Value from pipeline by property name: | True |
| Value from remaining arguments: | False |
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.