Hello,
We have a similar suggestion in our product backlog, but currently this can be done only with the help of a PowerShell script. The following script executed in a Business Rule triggered after updating a user's UPN on-premises will update a user's UPN in Office 365:
Import-Module MSOnline
$o365ObjectIdBinary = $Context.TargetObject.Get("adm-O365ObjectId")
$o365ObjectId = New-Object "System.Guid" @(,$o365ObjectIdBinary)
Set-MsolUserPrincipalName -ObjectId $o365ObjectId -NewUserPrincipalName "%userPrincipalName%"
To create such a Business Rule:
- Create a new Business Rule.
- On the 2nd step of the Create Business Rule wizard, select User and After Updating a User.
- On the 3rd step, add the Run a program or PowerShell script action and paste the above script in the Script field.
- Enter a short description for the script and click OK.
- To run the script only when a UPN is modified, you'll need to add a condition. Right-click the action you've just added and click Add Condition.
- Select the If <property> changed condition type.
- Select the User Logon Name property.
- Select has changed.
- Click OK and finish creation of the Business Rule.