Created
April 13, 2023 19:28
-
-
Save RylandDeGregory/ca5a5a44ebea48a2d7c3d8daf10c293f to your computer and use it in GitHub Desktop.
Merge ADDS user with existing Azure AD user.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get the Immutable ID of the ADDS user | |
$Name = 'My Name' | |
$ADUser = Get-ADUser -Filter 'Name -like "*$Name*"' | |
$ImmutableId = [System.Convert]::ToBase64String($ADUser.ObjectGUID.tobytearray()) | |
# Connect to Azure AD | |
Connect-AzureAD | |
# Remove the duplicated user from Azure AD that was created when the ADDS user was first synced | |
Remove-AzureADUser -ObjectId <duplicated AAD user ObjectId> | |
# Set Immutable ID of existing AAD user to the value obtained from the ADDS user | |
Set-AzureADUser -ObjectId <existing AAD user ObjectId> -ImmutableId $ImmutableId | |
# Start AAD Sync cycle | |
Start-ADSyncSyncCycle -PolicyType Delta |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment