I get this nasty error when i run this PS: Set-Mailbox "user@domain.com" -EmailAddresses SMTP:user@domain.com,user@domain.onmicrosoft.com
The operation on mailbox "User" failed because it's out of the
current user's write scope. The action 'Set-Mailbox', 'EmailAddresses', can't
be performed on the object 'User' because the object is being
synchronized from your on-premises organization. This action should be
performed on the object in your on-premises organization.
We have migrated all mailboxes to the O365 cloud and removed the onprem Exchange server.
ADFS and DirSync are enabled and happy.
When we create a new user in the AD it syncs to the cloud, where we assign it a license and the mailbox gets created.
The UPN gets created ok as user@domain.com, but the problem is that the process creates the mailbox with SMTP:user@domain.onmicrosoft.com and proxy user@domain.com
In the AD we have domain.com and domain.local but the domain.com is assigned as principal to the user prior to the DirSync. The domain domain.onmicrosoft.com is not present in the local AD.
When i try to change it on the cloud with the PS above i get an error message that I cannot change it because the user is out of scope and managed by the local AD. But in the AD i do not have those fields to change...
what i am doing wrong? should be something so obvious but i can't seem to find it.