So this is just for me. I don’t do this that often, but we do have one of our employees get married on occasion and when they do their last name usually changes. When HR sends a name change to the system we have to change their last name in our Active Directory environment. Since we have a Hybrid system with O365 involved we have to change it there too. We have not yet installed AD Connect so we have to do the name change manually. It only takes a few minutes so its not too bad. Here is the PowerShell code that I use to change the UPN of the person that had the name change.
Step 1: Connect to Azure Active Directory
- Connect-MsolService
Step 2: I like to make sure that everything exists as it should so I make sure they are in our database and were indeed moved there.
- Get-MsolUser -UserPrincipalName “username”
Step 3: Once I know the username is correct and that I have the right person I go ahead and change it with this command.
- Set-MsolUsePrincipalName -UserPrincipalName “username” -NewUserPrincipalName “newusername”
This is my way of taking notes and writing stuff down. I also really don’t have to go back to google because I forgot the URL where I found it. I could save the URL as a favorite, but then I would have a ton of saved book marks.