Bulk Add Alias after AD Sync

Shannon Harvey 21 Reputation points
2021-09-22T14:02:37.427+00:00

Hello All,

Is it possible to add an alias to an account via PowerShell after it has been synched? I have put together a csv file that contains a test user, when executing the command listed below, I am presented with the error shown just below that and I'm not sure which direction I should be going in. Can someone here look provide me with some guidance as to what my next steps should be?

here is the command I'm running in a EXOPSession

$Recipients = Import-Csv C:\export\copy.csv
Foreach ($Item in $Recipients)
{
Set-Mailbox -Identity $Item.Identity -EmailAddresses @{Add=$Item.Alias}
}

Here is what I get after the fact.

An Azure Active Directory call was made to keep object in sync between Azure Active Directory and Exchange Online.
However, it failed. Detailed error message:
Unable to update the specified properties for on-premises mastered Directory Sync objects or objects currently
undergoing migration. DualWrite (Graph) RequestId: e96df326-2e93-4a4a-bf54-60bb28c14778
The issue may be transient and please retry a couple of minutes later. If issue persists, please see exception members
for more information.
+ CategoryInfo : NotSpecified: (:) [Set-Mailbox], UnableToWriteToAadException
+ FullyQualifiedErrorId : [Server=DM6PR16MB3259,RequestId=7270c2c6-1f53-4b20-84e0-bcc5bba2471c,TimeStamp=9/22/2021
1:54:46 PM] [FailureCategory=Cmdlet-UnableToWriteToAadException] 8054C4AA,Microsoft.Exchange.Management.Recipient
Tasks.SetMailbox
+ PSComputerName : outlook.office365.com

It seems to me that I cant make this kind of update after I have synchronized a user from onprem to Azure. If that be the case can someone here also make a recommendation as to how I can go about accomplishing this? The issue we're having is this, we need to change all of our usernames to match SAMAccountName. In doing so we need to also take the existing username which is firstname.lastname@keyman .com and make that an alias so that our users continue to receive mail from external sources.

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
20,464 questions
0 comments No comments
{count} votes

Accepted answer
  1. Andy David - MVP 144.8K Reputation points MVP
    2021-09-22T14:04:02.747+00:00

    Any changes have to be applied on-prem. They will sync to Azure.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful