Avatar of motorhog
motorhogFlag for United Kingdom of Great Britain and Northern Ireland

asked on 

Office 365 Email Address not using custom domain

We are deploying Office 365 and setting up a new domain for a new company. There is an on-site AD using the Sync program to sync accounts to O365.

We have a problem whereby everyones default outbound email address is not using our own domain name but is using the company.onmicrosoft.com one.

In the AD users, the UPN is set to use the correct domain name, in O365 it wont allow us to update the priamry email address, but says to update it on the AD. im not sure where to update this, or waht to do to fix it?

Any help appreciated.

Thanks
Microsoft OfficeEmail ServersMicrosoft 365

Avatar of undefined
Last Comment
Adam Brown
ASKER CERTIFIED SOLUTION
Avatar of Vasil Michev (MVP)
Vasil Michev (MVP)
Flag of Bulgaria image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Did you add the new domain name in your Office 365 Tenant? If not add the domain to Office 365 Tenant.


Please refer the steps mentioned in the article "Add a domain to Office 365"

https://docs.microsoft.com/en-us/office365/admin/setup/add-domain?view=o365-worldwide
Avatar of Adam Brown
Adam Brown
Flag of United States of America image

Office 365 requires a few attributes to be set properly when syncing before it will apply the custom domain. In addition, you need to make sure the custom domain is tagged as the "Default" domain. The attributes that need to be properly populated are:
proxyaddresses (with the primary address using SMTP in caps)
mail
mailnickname (This is the user's "alias," or what shows up before the @ sign in the email address)

If these aren't set properly, Exchange Online will determine the values for you and assign the onmicrosoft.com domain.
Avatar of motorhog
motorhog
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

Yeah, we found setting the proxy address with the Capital SMTP has worked. I've run a powershell script on the AD to set the proxyaddress in bulk, I used this,

$userOU = 'OU=Test,OU=Users,OU=DNB,DC=internal,DC=domain,DC=co,DC=uk'
$users = Get-ADUser -Filter * -SearchBase $userou -Properties SamAccountName
 
ForEach ($User in $Users) {
$SamAccountName = $User.SamAccountName
Set-ADUser -Identity "$SamAccountName" -Add @{
        'proxyAddresses'="SMTP:$SamAccountName@domain.co.uk"
}
 
}

Open in new window


Once the Sync to O365  had run all users had their primary address as Custom Domain.

Going forward, is there any way of setting the Proxyaddress automatically when a new user is created??
Best thing to do is populate proxyaddresses, as discussed above. You can add it as a step in your "provision user" flow.

If the proxyaddresses value is empty, the mailnickname/alias attribute will be used, along with the default domain value. If that is also empty, the UPN will be used. Rules are summarized below:

The proxy calculation logic uses the following sequence to calculate proxy addresses:

1. The default proxy address (SMTP, all capitals within proxyAddresses attribute) is checked first. If the domain is verified, the proxy address is synchronized and you will be provided with an MOERA based on your default proxy address alias. For example, if your default proxy address is joe@contoso.com, this proxy address will be synchronized and you will have an alternate email address of joe@contoso.onmicrosoft.com.

If your on-premises default proxy address domain is not verified, your SMTP address in Office 365 will use the MOERA based on the on-premises SMTP proxy address alias. For example, if your default proxy address is joe@contoso.com and contoso.com is not verified, your Office 365 default proxy address will be joe@contoso.onmicrosoft.com.

2. This step only applies if step 1 was not met and the user has a on-premises mail attribute:

o If the user does not have any on-premises proxy addresses and the email address domain within the mail attribute is verified, the user's Office 365 default email address will match the user's mail attribute.

o If the user does not have any on-premises proxy addresses and the email address domain within the mail attribute is not verified, the user's Office 365 default email address uses the alias portion of the users on-premises mail attribute and the MOERA domain. For example, if the users mail attribute is joe@contoso.com and the domain is not verified, your Office 365 default proxy address will be joe@contoso.onmicrosoft.com.

o If the user does have an on-premises proxy addresses, the user's Office 365 default email address uses the alias portion of the user's on-premises mail attribute and the MOERA domain. For example, if the user's mail attribute is joe@contoso.com and the domain is not verified, your Office 365 default proxy address will be joe@contoso.onmicrosoft.com even if the email domain of the mail attribute is verified.

3. This step only applies if logic step 1 and 2 are not met:

o Your Office 365 default proxy address will be based on your user principal name (UPN) alias and your MOERA domain even if the UPN domain is verified. For example, joe@contoso.onmicrosoft.com. .
Avatar of Adam Brown
Adam Brown
Flag of United States of America image

No way to automate it unless you are creating users with a script or using Exchange Onprem tools to create new mailboxes and users at the same time, then migrate them (a headache).
Microsoft Office
Microsoft Office

Microsoft Office is an integrated suite of applications that includes Outlook, Word, Excel, Access, PowerPoint, Visio and InfoPath, along with a number of tools to assist in making the individual components work together. Coding within and between the projects is done in Visual Basic for Applications, known as VBA.

80K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo