question

ShannonHarvey-8555 avatar image
0 Votes"
ShannonHarvey-8555 asked AndyDavid commented

Bulk Add Alias after AD Sync

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@domain.com and make that an alias so that our users continue to receive mail from external sources.

azure-ad-connect
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

AndyDavid avatar image
1 Vote"
AndyDavid answered AndyDavid commented

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

· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Okay so how can I accomplish this? I need to change the current UPN in Azure/O365 and have the current UPN become alias. I have a csv and subsequent command for changing the current UPN in O365 but how can I have the current UPN become the alias?

0 Votes 0 ·

Andy,

I was able to answer my own question, but I have another. Would I change the UPN after I sync or before?

0 Votes 0 ·
AndyDavid avatar image AndyDavid ShannonHarvey-8555 ·

Before :)

0 Votes 0 ·