-
Notifications
You must be signed in to change notification settings - Fork 0
Remove PpacUser
Remove a user from a Power Platform environment.
Remove-PpacUser [-EnvironmentId] <String> [-User] <String> [[-Role] <String[]>]
[-ProgressAction <ActionPreference>] [<CommonParameters>]
Removes the Dataverse systemuser for a Microsoft Entra ID user. Optionally only removes one or more security role assignments and keeps the user.
Removal order is enforced by the platform: all role assignments must be removed first, then the user must be disabled before DELETE. Users that still exist in Entra ID cannot be hard deleted (0x80048359) - those stay in place as disabled users without roles.
Remove-PpacUser -EnvironmentId "ContosoEnv" -User "megan.bowen@contoso.com"
Removes all security roles from megan.bowen@contoso.com, disables the user and deletes it. When the user still exists in Entra ID it stays as a disabled user without roles.
Remove-PpacUser -EnvironmentId "ContosoEnv" -User "megan.bowen@contoso.com" -Role "System Administrator"
Only removes the System Administrator role assignment and keeps the user.
The id of the environment that you want to work against.
Can be either the environment name, the environment GUID (PPAC) or the LCS environment ID.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThe user that you want to remove from the Power Platform environment.
Can be either the User Principal Name (UPN), mail address or Entra object id.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseOnly remove the supplied security role assignment(s) and keep the user.
Can be either the role name or the role ID. When omitted the user is fully removed (all roles, disable, delete).
Type: String[]
Parameter Sets: (All)
Aliases: RoleName
Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False{{ Fill ProgressAction Description }}
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Author: Mötz Jensen (@Splaxi)