The Set-MsolUserPrincipalName cmdlet in PowerShell changes the user principal name, or user ID of a user in Microsoft Office 365. This command can be used to move a user between federated and standard domains, which results in the authentication type changing to that of the target domain.
The syntax to change the user principal name in Azure Active Directory is given below.
Set-MsolUserPrincipalName
-ObjectId <Guid>
-NewUserPrincipalName <String>
-UserPrincipalName <String>
[-ImmutableId <String>]
[-NewPassword <String>]
[-TenantId <Guid>]
[<CommonParameters>]
In this article, we will discuss how to use the Set-MsolUserPrincipalName cmdlet in PowerShell to rename the user in Office 365.
How to Rename a User in Office 365
To rename a user in Office 365, use the Set-MsolUserPrincipalName cmdlet with the -NewUserPrincipalName
parameter.
The -NewUserPrincipalName
parameter specifies the new user ID of a user.
Set-MsolUserPrincipalName -UserPrincipalName "[email protected]" -NewUserPrincipalName "[email protected]"
This command renames the user principal name “[email protected]” to “[email protected]“.
Conclusion
I hope the above article on how to use the Set-MsolUserPrincipalName cmdlet in PowerShell to rename the user in Office 365 is helpful to you.
You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page.