Muokkaa

Jaa


Remove-MsolUser

Removes a user from Azure Active Directory.

Syntax

Remove-MsolUser
      -ObjectId <Guid>
      [-RemoveFromRecycleBin]
      [-Force]
      [-TenantId <Guid>]
      [<CommonParameters>]
Remove-MsolUser
      [-RemoveFromRecycleBin]
      [-Force]
      -UserPrincipalName <String>
      [-TenantId <Guid>]
      [<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.

Parameters

-Force

Indicates that this cmdlet does not prompt you for confirmation.

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

-ObjectId

Specifies the unique object ID of the user to remove.

Type:Guid
Position:Named
Default value:None
Required:True
Accept pipeline input:True
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
Required:False
Accept pipeline input:True
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
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-UserPrincipalName

Specifies the user principal name of the user to remove.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False