MailNickName or Alias attribute in Exchange Online doesn't match what is set in Exchange on-premises

Applies to: Exchange OnlineMicrosoft Exchange Online Dedicated

Symptoms


The Alias or Mailnickname attribute in Microsoft Exchange Online doesn't match what is set in the Exchange on-premises environment for a synced user account.

Cause


This issue occurs if changes are made to the user principal name (UPN) for the user and the Mailnickname attribute value is changed to the prefix of the UPN.

Resolution


To resolve this issue, update the Alias or Mailnickname attribute. To do this, use one of the following methods.
 

Method 1: Use Exchange Management Shell

  1. Change the existing Alias attribute value so that the change is found by Azure Active Directory (Azure AD) Connect. This should sync the change to Office 365. To do this, use either the Set-Mailbox or Set-RemoteMailbox cmdlet, based on the recipient type in Exchange on-premises. 

    Set-RemoteMailbox
    $alias=Get-remotemailbox user@domain.comSet-RemoteMailbox user@domain.com -alias "$($alias.alias)1"

    Set-Mailbox
     
    $alias=Get-mailbox user@domain.comSet-Mailbox user@domain.com -alias "$($alias.alias)1"
     
  2. Start a Delta sync from Azure AD Connect, or wait for Azure AD Connect to run the delta. Ideally, this should sync the changes that are made in step 1 to Office 365.
  3. Change the value of the Alias attribute to its original value. To do this, run either of the following cmdlets:
     
    Set-RemoteMailbox user@domain.com -alias "$($alias.alias)"
    Set-Mailbox user@domain -alias  "$($alias.alias)"
     
  4. Start a Delta sync from Azure AD Connect, or wait for Azure AD Connect to run the delta> Ideally, this should sync the changes to Office 365.
 

Method 2: Use Active Directory PowerShell Module

  1. Change the Mailnickname attribute value so that the change is discovered by Azure AD Connect. This should sync the change to Office 365. To do this, run the following set of cmdlets: 
     
    $mailnickname=Get-ADUser -Properties * -Filter {name -like 'username*'}Get-ADUser -Properties * -Filter {name -like 'username*'} | set-aduser -replace @{mailnickname="$($mailnickname.mailnickname)1"
     
  2. Start a Delta sync from Azure AD Connect, or wait for Azure AD Connect to run the delta. Ideally, this should sync the changes that are made in step 1 to Office 365.
  3. Change the value of the Mailnickname attribute to its original value. To do this, run the following cmdlet: 
     
    Get-ADUser -Properties * -Filter {name -like 'username*'} | set-aduser -replace @{mailnickname="$($mailnickname.mailnickname)"
     
  4. Start a Delta sync from Azure AD Connect, or wait for Azure AD Connect to run the delta. Ideally, this should sync the changes that are made in step 1 to Office 365.