Hello @eddy sophian
Thank you very much for reaching out to us in regards to your concern you can use the following script mention in the below article to bulk update the user Immutable ID also please confirm if your end goal is to hard match the users as said by @Vasil Michev .
Your CSV has to look something like this:
UserPrincipalName;Department;TelephoneNumber
manfreddelaat@keyman .nl;IT;0135113333
manfred@keyman .nl;IT;0622222222
Your Powershell code:
Connect to AzureAD
Connect-AzureAD
Get CSV content
$CSVrecords = Import-Csv C:\Test.csv -Delimiter ";"
Create arrays for skipped and failed users
$SkippedUsers = @()
$FailedUsers = @()
Loop trough CSV records
foreach ($CSVrecord in $CSVrecords) {
$upn = $CSVrecord.UserPrincipalName
$user = Get-AzureADUser -Filter "userPrincipalName eq '$upn'"
if ($user) {
try{
$user | Set-AzureADUser -ImmutableId $CSVrecord.ImmutableId
} catch {
$FailedUsers += $upn
Write-Warning "$upn user found, but FAILED to update."
}
}
else {
Write-Warning "$upn not found, skipped"
$SkippedUsers += $upn
}
}
Array skipped users
$SkippedUsers
Array failed users
$FailedUsers
In case you have any questions on the same, you can surely let us know and we will be happy to help you further. If this post provides you the answer you were looking for, do accept it as an answer in the interest of community members with similar queries. If this does not answer, please ask further in the comments and we will happy to address your concerns. Thank you.