Configuring UserPrincipalName and UPN suffixes in Active Directory

Add a UPN suffix in Active Directory Domains and Trusts under Properties > UPN Suffixes, then pick that suffix for each user on the Account tab in Active Directory Users and Computers, or set it in bulk with Set-ADUser.

This guide covers what the userPrincipalName attribute holds, the PowerShell commands for suffixes and users, how UPNs sync to Microsoft Entra ID, and what to watch for before you change them.

How to add alternative UPN suffix in Active Directory?

An alternative suffix lets users sign in as [email protected] even when the AD domain is contoso.local or corp.contoso.com. The suffix is stored once for the whole forest.

  1. On a domain controller, open Server Manager and select Tools > Active Directory Domains and Trusts. You can also press Win + R, type domain.msc and select OK.
  2. In the console tree, right-click Active Directory Domains and Trusts at the top and select Properties.
  3. Open the UPN Suffixes tab.
  4. In the Alternative UPN suffixes box, type the new suffix, such as contoso.com.
  5. Select Add, then Apply.
  6. Repeat for any other suffixes and select OK.

The suffix now appears in the UPN suffix list for every user in the forest. Nothing changes for existing accounts until you assign the suffix to them.

Configuring UserPrincipalName and UPN suffixes in Active Directory
Right-click Active Directory Domains and Trusts at the top of the console tree and choose Properties to reach the UPN Suffixes tab. (Image: Microsoft)

What is userPrincipalName in Active Directory?

The userPrincipalName attribute is the user's logon name. It is an Internet-style name based on RFC 822, and by convention it should match the user's email address.

Point What it means
Format A UPN prefix (the account name), the @ sign, and a UPN suffix (a DNS domain name), for example [email protected].
Uniqueness A UPN must be unique among all security principals in the forest. The same prefix can be reused with a different suffix.
Allowed suffixes The DNS name of any domain in the forest, or an alternative name listed in the upnSuffixes attribute of the Partitions container. It does not have to be the user's own domain.
Default suffix The DNS name of the domain where you created the account, so a user made in contoso.com gets [email protected].
Renames and moves The UPN is unaffected when the user object is renamed or moved, so the sign-in name survives a restructure.
Attribute type An indexed, single-valued string. It can be left empty when the account is created.
sAMAccountName The older pre-Windows 2000 logon name, limited to 20 characters and unique within the domain, not the forest.

At sign-in, a domain controller looks for the UPN in the local domain and then in the global catalog. If the global catalog does not hold it, the sign-in fails.

Add a UPN suffix with PowerShell Set-ADForest

The same change runs from PowerShell with the ActiveDirectory module. -UPNSuffixes edits the forest's msDS-UPNSuffixes property on the cross-reference container.

Set-ADForest -Identity contoso.local -UPNSuffixes @{Add="contoso.com","labs.contoso.com"}

Adds two alternative suffixes to the contoso.local forest without touching any that already exist. Use @{Replace=...} to overwrite the whole list instead.

You should see: The command returns no output. (Get-ADForest).UPNSuffixes now lists the new suffixes.

Run it from a session with rights to change the forest configuration. You can also pipe the current forest in: Get-ADForest | Set-ADForest -UPNSuffixes @{Add="contoso.com"}.

Changing the user principal name (UPN) in Active Directory

Active Directory Users and Computers changes one account at a time. It is part of the Remote Server Administration Tools, so you can also install Active Directory Users and Computers on a Windows 10 or 11 admin PC.

  1. Open Server Manager and select Tools > Active Directory Users and Computers, or press Win + R, type dsa.msc and select OK.
  2. Find the user, right-click the account and select Properties.
  3. Open the Account tab.
  4. Edit the logon name prefix in the first box if the name part should change.
  5. In the UPN suffix drop-down list next to it, select the new suffix.
  6. Select OK to save the change.

The drop-down only lists forest domains and the alternative suffixes added earlier. If the suffix you want is missing, add it first in Active Directory Domains and Trusts.

Change user principal name suffix on the Account tab in Active Directory
The drop-down beside User logon name lists forest domains plus any alternative suffixes, here @contoso.com and @contoso.local. (Image: Microsoft)

Change a user's UPN with PowerShell Set-ADUser

Set-ADUser -Identity bsimon -UserPrincipalName "[email protected]"

Sets the userPrincipalName of the account bsimon. The value takes the form user@DNS-domain-name, and the suffix must already exist in the forest.

You should see: No output. Get-ADUser bsimon | Select-Object UserPrincipalName shows the new value.

Because the UPN is independent of the distinguished name, the account can be moved or renamed later without changing its sign-in name.

Bulk change UPN suffix for all users with PowerShell

When many accounts use an old suffix such as contoso.local, change them in one pass. Test it on a small set of users before the whole domain.

$LocalUsers = Get-ADUser -Filter "UserPrincipalName -like '*contoso.local'" -Properties userPrincipalName -ResultSetSize $null
$LocalUsers | foreach {$newUpn = $_.UserPrincipalName.Replace("@contoso.local","@contoso.com"); $_ | Set-ADUser -UserPrincipalName $newUpn}

Finds every user whose UPN ends in contoso.local, with no limit on result size, and replaces the suffix with contoso.com while keeping each prefix. Change both domain names to match your own.

You should see: Running the first line again returns no users.

To try it on one OU first, add -SearchBase "OU=Pilot,DC=contoso,DC=local" to the Get-ADUser query on the first line.

List UPN suffixes and user UPNs in Active Directory with PowerShell

Get-ADForest | Select-Object -ExpandProperty UPNSuffixes
Get-ADUser -Filter * -Properties userPrincipalName | Select-Object Name, UserPrincipalName

The first line prints every alternative UPN suffix in the forest. The second lists each user's name beside its current UPN.

You should see: Your new suffix appears in the first list, and the changed accounts show it in the second.

An empty first result means the forest has no alternative suffixes, only the domain names themselves.

UPN suffix and Microsoft 365 sync with Entra Connect

Microsoft Entra Connect copies the on-premises userPrincipalName into Microsoft Entra ID, where it becomes the user's sign-in name. What arrives depends on whether the suffix is a verified domain in the tenant.

On-premises UPN UPN in Microsoft Entra ID
Suffix matches a verified domain ([email protected]) The same value, [email protected].
Non-routable suffix ([email protected]) Replaced with the initial domain, for example [email protected].
Suffix not verified in the tenant Rebuilt as MailNickName@initial domain, using the first of mailNickName, primary SMTP prefix, mail prefix, UPN prefix.
Contains a space, line break or other invalid character Treated as invalid and recalculated the same way as a non-verified suffix.

The fix for a .local forest is to add a routable UPN suffix that matches a verified Microsoft 365 domain and move users onto it before syncing. Microsoft describes changing the primary domain instead as an involved process.

UPN suffix sync check in Entra Connect sign-in configuration page
The wizard compares each on-premises UPN suffix with tenant domains; only suffixes marked Verified keep their value after sync. (Image: Microsoft)

What happens when you change a user's UPN

Sign-in pages often treat the UPN as an email address, so Microsoft recommends changing the UPN when the primary email changes. A change can still break things that store the old name.

Affected What can happen Workaround
SaaS and line-of-business apps Apps that use just-in-time provisioning can create a second profile for the new UPN. Use automated app provisioning, or have the app admin relink the profile.
Microsoft Entra joined devices Single sign-on problems after the change. Wait for the change to sync, then sign in with Other user.
Windows 10 hybrid joined devices Signing in before the new UPN syncs can cause SSO failures and a forced restart. Fixed in the Windows 10 May 2020 update. Run dsregcmd /leave, restart, then sign in with Other user.
Windows Hello for Business Users must enroll again after the device rejoins. Plan re-enrollment with the change.
Your own scripts Anything keyed on the UPN stops matching. Key scripts on objectGUID, which never changes.

Roll out bulk changes to a small pilot group first and keep a tested way to put the old UPNs back.

Change user UPN then sign in with Other user on Windows
After a UPN change syncs, select Other user at the bottom left of the sign-in screen and type the new UPN. (Image: Microsoft)

Remove a UPN suffix from Active Directory

  1. Run Get-ADUser -Filter "UserPrincipalName -like '*@labs.contoso.com'" to find accounts still using the suffix.
  2. Move those accounts to another suffix with Set-ADUser -UserPrincipalName.
  3. Run Set-ADForest -Identity contoso.local -UPNSuffixes @{Remove="labs.contoso.com"}.
  4. Run (Get-ADForest).UPNSuffixes and check that the suffix is gone from the list.

A UPN suffix must be a forest domain or a listed alternative, so move accounts off it before you remove it. Set-ADForest -UPNSuffixes $Null clears every alternative suffix at once; avoid it unless that is the intent.

UPN suffix not working in Active Directory

Synced users show an onmicrosoft.com UPN in Microsoft 365

The on-premises suffix is .local or is not a verified domain in the tenant.

  1. Add and verify the custom domain in Microsoft Entra ID.
  2. Add the same domain as an alternative UPN suffix in Active Directory Domains and Trusts.
  3. Change the users' UPNs to that suffix and let Entra Connect sync the update.

The new suffix does not appear in the user's Account tab

The suffix was never added at forest level, or was typed into the wrong forest.

  1. Run (Get-ADForest).UPNSuffixes and look for the suffix.
  2. Add it with Set-ADForest -UPNSuffixes @{Add="contoso.com"} if it is missing.
  3. Close and reopen Active Directory Users and Computers, then open the user's Account tab again.

User cannot sign in with the new UPN

The domain controller could not find the UPN in the global catalog, or a device still holds the old name.

  1. Check the change with Get-ADUser <user> -Properties userPrincipalName.
  2. Allow time for replication to reach the global catalog.
  3. On the sign-in screen, select Other user and enter the new UPN.

Entra ID UPN does not update after the change

Entra ID only recalculates the UPN when an on-premises UPN change syncs, and an unverified suffix is still replaced.

  1. Confirm the suffix is a verified domain in the tenant.
  2. Wait for the next Entra Connect sync cycle.
  3. Check the result in the Microsoft Entra admin center or with Get-MgUser in Microsoft Graph PowerShell.
UPN suffix not working: synced user gets onmicrosoft.com UPN in Entra
With an unverified suffix, Entra Connect builds the cloud UPN from the primary SMTP prefix and the initial onmicrosoft.com domain. (Image: Microsoft)

Active Directory UPN suffix FAQ

What is a UPN suffix in Active Directory?

A UPN suffix is the part of the user principal name after the @ sign, such as contoso.com in [email protected]. It must be the DNS name of a forest domain or an alternative suffix added in Active Directory Domains and Trusts.

What is the difference between UPN and sAMAccountName?

The UPN is an Internet-style name such as [email protected] that must be unique across the forest. The sAMAccountName is the older pre-Windows 2000 logon name, up to 20 characters and unique only within its domain.

Does a UPN suffix need to be a real domain?

In Active Directory it only needs to be a DNS-style name added to the forest. For Microsoft 365 and Entra ID sign-in, the suffix must match a domain you have verified in the tenant, or sync replaces it with onmicrosoft.com.

Can the UPN be different from the email address?

Yes, but Microsoft recommends keeping them identical. Sign-in pages often ask for an email address, so a mismatch confuses users. Entra ID also offers alternate login ID, which lets users sign in with the mail attribute instead.

Does changing a UPN change the user's SID or GUID?

No. The objectSid and objectGUID stay the same, so group memberships and permissions are kept. Only the sign-in name changes, but apps that store the UPN may treat the user as new.

Where are UPN suffixes stored in Active Directory?

They are stored in the upnSuffixes attribute of the Partitions container inside the Configuration container. Set-ADForest -UPNSuffixes edits this list, and Get-ADForest shows it in the UPNSuffixes property.

Philip Celasco

Philip is a Texas-based technology writer and IT administrator at Techdows.com with more than 10 years of experience creating practical content for everyday users and professionals. He specializes in web browsers, particularly Chromium-based platforms such as Google Chrome, Microsoft Edge, Brave, and Opera. Through his work as an IT administrator, Philip has hands-on experience managing devices, configuring browser policies, troubleshooting software and network issues, and helping people resolve problems that affect productivity and security. His articles are based on practical testing and real-world technical experience. He covers browser settings, extensions, performance problems, privacy controls, security features, and Windows troubleshooting. Outside work, Philip enjoys the quieter side of life in Texas and stepping away from the screen when he can. He has two kids, two cats and loves to play golf with his mother during the weekends.

Leave a Reply

Your email address will not be published. Required fields are marked *