Microsoft Entra Suite Tech Accelerator
Aug 14 2024, 07:00 AM - 09:30 AM (PDT)
Microsoft Tech Community

Bulk Update User Info in Azure Active Directory

Copper Contributor

Hi Community,

I have a small requirement of which I have to bulk change the User Principal Name and I have found few ways to achieve the same:

The website given below outlines the way this can be achieved. But the problem with this site, is that I am unable to understand which software tools the author has used to achieve this, and also there is some code snippet attached and couldn't understand where to copy and paste that code in the software that he used earlier.

So for someone having idea with Microsoft products, can you please me out in describing the software used and where can I execute the provided code on the software. So that it can help me achieve the required objective.

3 Replies
try the Azure Active Directory's specific community:

btw, I think what is shown in that blog post, is actually the same Azure Active Directory website that exists on Microsoft servers but in the older design, since that blog post is 4 years old (2016).

Thanks @HotCakeX


@KNDheerajHello! You've posted your question in the Community Discussion space, which is intended for discussion around the Tech Community website itself, not product questions. I'm moving your question to the Azure Active Directory space- please post AAD questions there in the future. 


@KNDheeraj if you don't really know what you are doing then this is somewhat dangerous. Running someone else's script without understanding it could cause you some serious issues that you cannot fix.

Also, even if this works do you understand the implications? The users must be aware and will need to sign in to applications using the new UPN. They may need to log out of some applications and back in again, and may need to tell the apps to forget the old ones.


I assume you have a global admin account?


That being said this is how you can do it. On Windows, search for 'powershell ISE'. Don't left click on the search result, but right click and choose 'run as administrator'.

When it opens, there should be 2 halves, a white one and a blue one. If not find the button at the top that says 'show script pane' and click in those until you have white at the top and blue at the bottom.

Then paste this into the white area:

Install-Module MSOnline

Hit the play button in the toolbar. This should install after a while, click Yes to all to any warnings.

Now, paste that guys script into the white area (replacing the bit above), modify the domains to suit and hit play again.

Finally, check that everyone's UPN has changed by typing get-msoluser in the bottom and then return.