If you have an Office 365 Enterprise subscription and dir sync (Directory Synchronization) configured in your environment so that your local Active Directory is used to manage your Office 365 mailboxes then you may be wondering how you set a primary SMTP address in Office 365.
The Global Address List shows the wrong email addresses for my users
You may initially discover after licensing and enabling your users in the Office 365 portal that when you look at the Global Address List (GAL) your users all have the wrong email address. You might see something like rstarr@mycompany.onmicrosoft.com rather than the expected rstarr@mycompany.com. An address with .onmicrosoft.com at the end is the default Microsoft Office 365 domain.
You next think, maybe I forgot to change it in the admin portal but nope, all your users are showing up correctly. To understand how this works will require a little deeper understanding and some PowerShell.
Examine a Mailboxes full properties in Office 365
So the first thing you want to do is list all the mailbox properties. Connect to your Office 365 session by following the Basics of Office 365 powershell article if you don’t know how.
Then run the following command:
get-mailbox rstarr@mycompany.com | form-list > c:\rstatt.txt
If Powershell tells you that you don’t have the command available then follow this post Logging Into Office 365 Powershell In Different Contexts (sorry,they make this overly complex).
Open up the created text file. In the output you will see a line:
EmailAddresses : {SMTP:rstarr@mycompany.onmicrosoft.com, smtp:rstarr@mycompany.com}
You will see that the mail address with the capitalized SMTP is the default. Now if your mailboxes weren’t managed by DirSync you could just run a Powershell command to change the Primary SMTP, but it is, so that wont work..
Set primary SMTP address in Office 365
To set the default to be rstarr@mycompany.com simple fill in the Email attribute field on the user object in the local Active Directory. You can then wait for the next replication cycle which will occur within 3 hours or perform a manual directory sync.
After the sync if you rerun the mailbox configuration command ( get-mailbox rstarr@mycompany.com | form-list > c:\rstatt.txt) you will see the correct SMTP address has been set as the primary.
[…] sure that your Office 365 uses have the correct primary SMTP address and also if you need to add other alternate SMTP addresses follow the Adding secondary SMTP […]