Forum Discussion
Adding email alias in Exchange Online no longer works and throws out the below error
If you have dirsync enabled, you cannot make such changes directly in ExO. Your on-premises AD is the "master" and O365 admin interfaces will always throw a similar error.
The only workaround for this scenario is to use the -WindowsEmailAddress parameter:
Set-Mailbox user@domain.com -WindowsEmailAddress new@domain.com
which will set new@domain.com as the new primary SMTP address, while keeping the old one as secondary. This still does not guarantee that the change will not be overwritten during the next full sync cycle, moreover it's not an officially supported mehtod.
- malone81Copper Contributor
- cameronshoveCopper Contributor
VasilMichev from where do you run this command? I tried to do so from O365 cloud PowerShell but the Get-Mailbox command is unknown, even after running: Install-Module MSOnline
and Import-Module MSOnline. Thank you- Deleted
cameronshove
To run get-mailbox or set-mailbox, you need to be connected to the exchange online PowerShell module. The one you were connected to is for MSOL service.Use the commands below. A sample is also shown in the attached screenshot.
- Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned
- Type in A (Yes to All) on the next line and hit the enter key.
- Install-module exchangeonlinemanagement -Scope CurrentUser -Force
- import-module exchangeonlinemanagement
- connect-exchangeonline (this will pop-up a window to authenticate with your admin account)
Once you authenticate with the admin account, you will be able to run the CMDLETS under exchange online. However, some EXO commands requires additional permission to be assigned to the account that is being used.
- Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned
- ZakonCopper ContributorHi Malone81,
As Vasil Michev said, if you are using Hybrid mode then you will be able to edit EXO objects only from the on-premise side.
If you want to add new SMTP address to mailbox in EXO you need to do that on mailbox located in the On-premise Exchange. To be sure that the object in cloud and on-premise is same object you can validate it by checking ExchangeGuid attribute- for both object should be same(that's how the Exchange on-premise and EXO is checking if objects should be "connected").