How to update immutableID for all user in Azure AD

eddy sophian 26 Reputation points
2021-02-17T01:59:12.187+00:00

Hi,

I have a CSV file that contains ImmutableID and UPN with the following headers for all user to be sync to Azure AD:

UserPrincipalName
ImmutableID

How can I set all user to use the CSV to update into the cloud?

68891-immutableid.png

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
21,301 questions
0 comments No comments
{count} vote

2 answers

Sort by: Most helpful
  1. Vasil Michev 103.5K Reputation points MVP
    2021-02-17T07:57:45.82+00:00

    Can you tell us what exactly are you trying to achieve here? Are you attempting to use the "hard match" method or something else entirely?

    0 comments No comments

  2. mirba-msft 651 Reputation points Microsoft Employee
    2021-02-17T12:15:36.383+00:00

    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

    https://techcommunity.microsoft.com/t5/windows-powershell/bulk-update-azure-ad-with-user-attributes-from-csv/m-p/1374479

    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.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.