Remove-EntraScopedRoleMembership
Removes a scoped role membership.
Syntax
Default (Default)
Remove-EntraScopedRoleMembership
-AdministrativeUnitId <String>
-ScopedRoleMembershipId <String>
[<CommonParameters>]
Description
The Remove-EntraScopedRoleMembership cmdlet removes a scoped role membership from Microsoft Entra ID. Specify AdministrativeUnitId and ScopedRoleMembershipId parameter to remove a scoped role membership.
Examples
Example 1: Remove a scoped role membership
Connect-Entra -Scopes 'RoleManagement.Read.Directory'
$role = Get-EntraDirectoryRole -Filter "DisplayName eq 'Helpdesk Administrator'"
$administrativeUnit = Get-EntraAdministrativeUnit -Filter "DisplayName eq 'Pacific Administrative Unit'"
$roleMembership = Get-EntraScopedRoleMembership -AdministrativeUnitId $administrativeUnit.Id | Where-Object {$_.RoleId -eq $role.Id}
Remove-EntraScopedRoleMembership -AdministrativeUnitId $administrativeUnit.Id -ScopedRoleMembershipId $roleMembership.Id
This cmdlet removes a specific scoped role membership from Microsoft Entra ID. You can use the command Get-EntraAdministrativeUnit to get administrative unit Id.
-AdministrativeUnitIdparameter specifies the ID of an administrative unit.-ScopedRoleMembershipIdparameter specifies the ID of the scoped role membership to remove. To obtain the details of a scoped role membership, you can use theGet-EntraScopedRoleMembershipcommand.
Parameters
-AdministrativeUnitId
Specifies the ID of an administrative unit object.
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 |
-ScopedRoleMembershipId
Specifies the ID of the scoped role membership to remove.
Parameter properties
| Type: | System.String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
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.