Set-MsolUserPrincipalName

Changes the user ID for a user.

Syntax

Set-MsolUserPrincipalName
   -ObjectId <Guid>
   -NewUserPrincipalName <String>
   [-ImmutableId <String>]
   [-NewPassword <String>]
   [-TenantId <Guid>]
   [<CommonParameters>]
Set-MsolUserPrincipalName
   -NewUserPrincipalName <String>
   [-ImmutableId <String>]
   [-NewPassword <String>]
   -UserPrincipalName <String>
   [-TenantId <Guid>]
   [<CommonParameters>]

Description

The Set-MsolUserPrincipalName cmdlet changes the User Principal Name, or user ID, of a user. This cmdlet can be used to move a user between a federated and standard domain, which results in their authentication type changing to that of the target domain.

Examples

Example 1: Rename a user

PS C:\> Set-MsolUserPrincipalName -UserPrincipalName "[email protected]" -NewUserPrincipalName "[email protected]"

This command renames [email protected] to [email protected].

Parameters

-ImmutableId

Specifies the immutable ID of the user's federated identity. This is required if moving the user from a standard to a federated identity domain.

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

-NewPassword

Specifies the new password for the user. This is required if moving the user from a federated to a standard identity domain.

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

-NewUserPrincipalName

Specifies the new user ID of the user.

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

-ObjectId

Specifies the unique object ID of the user to update.

Type:Guid
Position:Named
Default value:None
Required:True
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 original user ID of the user to update.

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