Create a UPN Suffix using PowerShell for Office 365 Migration.

In preparation for Office 365 migration, we had to match the current on premise users’ logon name (UserPrincipalName) with their email addresses to eliminate any user confusion and ease the outlook authentication process .As an example,

The on premise logon name is :
Email Address is :

To match the On premise logon with user email address, we’ll create an additional UPN suffix by opening Active Directory Domains and Trust, right the upper left server folder and select Properties:


Enter the required alternative UPN suffix as indicated below, click Add and Ok:


To verify the changes and update a user’s upn suffix, open Active Directory Users and Computers, select the user, right click and select properties, select the Account tab:


In the user logon name field, select the new upn, change the name from TobeGray to Tobe.Gray and click ok. The user’s logon token will be populated with the new upn property and resolve any outlook authentication errors that might occur due to a logon name and email address mismatch after mailbox migration to Office 365 tenant.

The same operation could also be accomplished with the following PowerShell script:

PS C:\scripts> Get-ADForest | fl UPNSuffixes

UPNSuffixes : {}

PS C:\scripts> Get-ADForest | Set-ADForest -UPNSuffixes @{add=""}


This entry was posted in Active Directory, Active Directory Domain Services, Azure Windows PowerShell, Office 365, PowerShell, PowerShell 3.0, Powershell 4.0 and tagged , , , , , . Bookmark the permalink.

4 Responses to Create a UPN Suffix using PowerShell for Office 365 Migration.

  1. peaciano says:

    Thanks for sharing jbernec.

  2. Pingback: PowerShell Script to Bulk Update UPN (UserPrincipalName) Suffix in a Single Domain. | chinny chukwudozie,it pro

  3. Dana says:

    I get html formatted output, but the command/content of what I copied is missing. I’m copying from the editor pane in ISE. Any idea?
    I copy:
    Get-ADForest | fl UPNSuffixes
    Get-ADForest | Set-ADForest -UPNSuffixes @{add=””}

    I get:


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s