Remove-​Msol​User

Removes a user from Azure Active Directory.

Syntax

Remove-MsolUser
      [-Force]
      -ObjectId <Guid>
      [-RemoveFromRecycleBin]
      [-TenantId <Guid>]
      [<CommonParameters>]
Remove-MsolUser
      [-Force]
      [-RemoveFromRecycleBin]
      [-TenantId <Guid>]
      -UserPrincipalName <String>
      [<CommonParameters>]

Description

The Remove-MsolUser cmdlet is used to remove a user from Azure Active Directory. This cmdlet deletes the user, their licenses, and any other associated data.

Examples

Example 1: Remove a user

Remove-MsolUser -UserPrincipalName "davidchew@contoso.com"

This command removes the user davidchew@contoso.com from Azure Active Directory. If the user has any licenses, the cmdlet removes these. The command prompts you to confirm the operation.

Example 2: Remove a user without confirmation

Remove-MsolUser -UserPrincipalName "davidchew@contoso.com" -Force

This command removes davidchew@contoso.com from Azure Active Directory. If the user has any licenses, the cmdlet removes these.

Example 3: Remove a user from the Recycle Bin

Remove-MsolUser -UserPrincipalName "davidchew@contoso.com" -RemoveFromRecycleBin

This command removes davidchew@contoso.com from the Azure Active Directory recycle bin. The command prompts you to confirm the operation. This command permanently removes the user.

Required Parameters

-ObjectId

Specifies the unique object ID of the user to remove.

Type:Guid
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-UserPrincipalName

Specifies the user principal name of the user to remove.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False

Optional Parameters

-Force

Indicates that this cmdlet does not prompt you for confirmation.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-RemoveFromRecycleBin

Indicates that this cmdlet permanently removes a deleted user from the recycle bin. This operation which can be applied only to deleted users. When this operation has been completed, you will not be able to recover the user by using the Restore-MsolUser cmdlet.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-TenantId

Specifies the unique ID of the tenant on which to perform the operation. The default value is the tenant of the current user. This parameter applies only to partner users.

Type:Guid
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False