0 votes

We noticed when renaming a user or changing the UPN it does not update in office365. I can change the username field by usign the following command from azure powershell module.

Set-MsolUserPrincipalName -UserPrincipalName mary.osgood@contoso.onmicrosoft.com -NewUserPrincipalName mary.smith@contoso.com

What is a good way to make this a seamless task for our helpdesk? Can adaxes do this natively without a powershell script?

by (340 points)

1 Answer

0 votes
by (216k points)
selected by
Best answer

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:

  1. Create a new Business Rule.
  2. On the 2nd step of the Create Business Rule wizard, select User and After Updating a User.
  3. On the 3rd step, add the Run a program or PowerShell script action and paste the above script in the Script field.
  4. Enter a short description for the script and click OK.
  5. 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.
  6. Select the If <property> changed condition type.
  7. Select the User Logon Name property.
  8. Select has changed.
  9. Click OK and finish creation of the Business Rule.
0

Thanks so much for the quick/great response. Worked perfectly.

Related questions

0 votes
1 answer

We noticed when renaming a user or changing the UPN it does not update in office365. I can change the username field by usign the following command from azure ... seamless task for our helpdesk? Can adaxes do this natively without a powershell script?

asked Oct 25, 2018 by huuchuan1113 (50 points)
0 votes
1 answer

I have been searching your site, but could not find a list of access rights needed. --- Morten A. Steien

asked Feb 23, 2021 by Morten A. Steien (300 points)
0 votes
1 answer

How do I change this policy as well as the information on the self-service password reset webpage from 30 days to 10 days?

asked Jan 30 by farid.r (40 points)
0 votes
1 answer

Just wanted to know if we could: Change the name of "Rename" Hide it altogether from the user page We've created a custom rename comand would prefer to simplify the user interface.

asked Nov 22, 2024 by msheppard (720 points)
0 votes
1 answer

User received email from Lumifi and wanted to verify if legit or if this is not from Adaxes?

asked Nov 30, 2022 by Jeff.Briand (80 points)
3,634 questions
3,322 answers
8,398 comments
548,768 users