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 (215k 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 (150 points)
0 votes
0 answers

We are in hybrid mode with 365. All the accounts we create have to made with a .com instead of .local. How can I make that change in adaxes? Or is this some default I need to change in AD instead?

asked Apr 11 by LEGIT1 (120 points)
0 votes
1 answer

Hi , I would like to know that is there any API service, where we can work on objects inside Adaxes tool? Preferbly REST API?

asked Nov 6, 2019 by Anil (20 points)
0 votes
1 answer

Hello. We need Adaxes to run a script every night that strips leading zeroes off of employee ID. Or better yet (each time the employee ID is set or changed?) Example: Tech puts ... ID. It will strip it down to 556 Would powershell be the way to do this? Thanks

asked Dec 20, 2021 by silicondt (40 points)
2,779 questions
2,512 answers
6,574 comments
25,881 users