ISSUE: Create O365 User command failed on incorrect syntax
Last modified:
Overview
Create O365 User step may failed to create a leaver user because user name contains special characters not excepted by O365. In the case of user containing unsupported character you will receive following error:
"O365_CreateO365User Phase 1: An error occurred during MSOL Powershell | Exception message 1: Invalid syntax. Parameter Name: USERPRINCIPALNAME.Exception message 2: Invalid syntax. Parameter Name: USERPRINCIPALNAME.Exception message 3: Invalid syntax. Parameter Name: USERPRINCIPALNAME. | Parameters: [upn, LEAVER_Arthi[2010_03_06_2014_07_07.Balmakhun_Madaree@standardbank.onmicrosoft.com] [preferredDataLocation, ZAF] [displayName, LEAVER_Arthi[2010_03_06_2014_07_07.Balmakhun_Madaree@standardbank.onmicrosoft.com] [firstName, LEAVER_] [lastName, Arthi[2010_03_06_2014_07_07.Balmakhun_Madaree] [department, ] [ProcessResult]"
Solution
You can replace the special characters for the users by running SQL queries in the attached file against tenant database.
NOTE: if you still find some user with incorrect syntax after you ran the queries you need to fix the issues individually by updating this three columns:
update Mailboxes set UserPrincipalName = 'Leaver Correct Syntax' where UserPrincipalName='Leaver Incorrect Syntax'
update Mailboxes set PrimarySmtpAddress = 'Leaver Correct Syntax' where PrimarySmtpAddress='Leaver Incorrect Syntax'
update LeaverMappingSelection set LeaverTempIdentifier='Leaver Correct Syntax' where LeaverTempIdentifier='Leaver Incorrect Syntax'