The Onmicrosoft.com email address gets stamped the time an Exchange license is assigned to the user. When creating the Onmicrosoft.com email address for the user, we look at the mailNickname attribute value for this user on the cloud.
The mailNickName value is derived from 3 places:
o From AD, if the mailNickName attribute is present and populated with a value. This mailNickName attribute gets added as a part of extending the AD schema when preparing for Exchange.
o From the Primary SMTP address specified in AD (i.e. the Mail and ProxyAddresses attributes). If Abizer.Haz@contoso.com is set as primary SMTP address, “Abizer.Haz” will be used as the mailNickname on the cloud side.
o If the above 2 values are not present, we rely on the UPN to derive the mailNickname. If UPN is Abizerh@contoso.com, then the mailNickname would be “Abizerh”.
The Onmicrosoft.com email address added initially, will always stay with the user, while he is on the cloud.
The OTHER time the Onmicrosoft.com email added is added to the user is when:
The user has a loginname with xx.onmicrosoft.com suffix (like firstname.lastname@example.org) and the loginname is changed to another login name with the same xx.onmicrosoft.com suffix (Abizerh22@contoso.onmicrosoft.com),
we add a new smtp address that matches the new loginname. So now the user would have 2 Onmicrosoft email addresses i.e Abizerh11@contoso.onmicrosoft.com and Abizerh22@contoso.onmicrosoft.com.
- When a user on cloud with login name email@example.com (Eg: firstname.lastname@example.org) changes his loginname on cloud to email@example.com, we add a new smtp address that matches the new loginname.
**We ensure that for every user licensed for Exchange, we have a smtp address for the user that matches his or her UPN.
**Same goes for a user with login name UserC@contoso.onmicrosoft.com.
You cannot update the Onmicrosoft.com email addressed for a Dirsync-ed user, by adding the Onmicrosoft.com email address to the proxyaddress list of the AD user.
After assigning the Exchange license to the user, once his mailbox is created, if you plan to modify the prefix of the email addresses by modifying the mailNickName attribute of the AD user and syncing it to the cloud, it does not affect the
email address for the user on cloud. This does not help even if you remove and assign the Exchange license with the new mailNickname.
Email addresses that will not get synced from on-premise AD to Cloud for a user:
- Email with suffix for which you don’t have a verified domain under your tenant.
- Email addresses which are already present for a different user, contact or groups on cloud.
- Email with onmicrosoft.com in the suffix.
Method used to modify the login name of users under the tenant, that trigger updated to the proxyaddresses:
- Set-MsolUserPrincipalName -UserPrincipalName [ExistingUPN] -NewUserPrincipalName [NewUPN]
Cmdlet used to update the Email address directly:
- Set-Mailbox -Identity "firstname.lastname@example.org" -EmailAddresses @("SMTP:email@example.com";"smtp:firstname.lastname@example.org";"sip:email@example.com")