Home
%3CLINGO-SUB%20id%3D%22lingo-sub-900063%22%20slang%3D%22en-US%22%3EPowerShell%20Basics%3A%20How%20to%20Force%20a%20Full%20Password%20Sync%20in%20AzureAD%20Connect%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-900063%22%20slang%3D%22en-US%22%3E%3CP%3EBefore%20starting%20this%20post%2C%20the%20team%20would%20like%20to%20thank%20all%20the%20contributions%20shared%20by%20the%20%3CA%20title%3D%22PowerShell%20community%20found%20on%20Reddit%22%20href%3D%22https%3A%2F%2Fwww.reddit.com%2Fr%2FPowerShell%2Fcomments%2Fdcp39f%2Fhow_to_force_azuread_connect_to_sync_via%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3EPowerShell%20community%20found%20on%20Reddit%3C%2FA%3E%20for%20their%20support%20on%20exploring%20PowerShell%20automation%20capabilities.%26nbsp%3B%20The%20outpouring%20of%20suggestions%20and%20sharing%20of%20scripts%20was%20awesome%20and%20has%20resulted%20in%20another%20question%20asked%20for%20us%20as%20a%20community%20to%20address.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAfter%20reading%20the%20previous%20%3CA%20title%3D%22PowerShell%20Basics%3A%20How%20to%20Force%20AzureAD%20Connect%20to%20Sync%22%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FITOps-Talk-Blog%2FPowerShell-Basics-How-to-Force-AzureAD-Connect-to-Sync%2Fba-p%2F887043%3FWT.mc_id%3DITOPSTALK-blog-abartolo%22%20target%3D%22_blank%22%20rel%3D%22noopener%22%3EPowerShell%20Basics%20article%3C%2FA%3E%2C%20some%20from%20the%20ITPRO%20community%20have%20reached%20out%20inquiring%20how%20to%20force%20the%20sync%20of%20only%20passwords%20and%20not%20the%20entire%20contents%20of%20Active%20Directory.%26nbsp%3B%20It%20appears%20the%20ask%20comes%20in%20light%20of%20troubleshooting%20Office%20365%20password%20sync%20issues.%26nbsp%3B%20This%20post%20will%20focus%20on%20steps%20to%20address%20this%20via%20PowerShell.%20%3CBR%20%2F%3E%26nbsp%3B%3CBR%20%2F%3ELets%20begin.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3ERun%20PowerShell%3CBR%20%2F%3E%26nbsp%3B%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F135894iDF470B1FB4242B46%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22How_to_Force_a_Full_Password_Sync_in_AzureAD_Connect_001.png%22%20title%3D%22How_to_Force_a_Full_Password_Sync_in_AzureAD_Connect_001.png%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3ERun%20PowerShell%20Force%20AzureAD%20Password%20Sync%3C%2FSPAN%3E%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%3C%2FLI%3E%0A%3CLI%3EAssign%20the%20local%20Active%20Directory%26nbsp%3B%3CSTRONG%3E%24adConnector%26nbsp%3B%3C%2FSTRONG%3Evalue%20and%20remember%20it%20is%20case%20sensitive%3A%26nbsp%3B%3CBR%20%2F%3E%26nbsp%3B%3CPRE%3E%24adConnector%20%3D%20%22%26lt%3Binsert%20local%20connector%20name%20here%26gt%3B%22%3C%2FPRE%3E%0A%3CCODE%3E%3C%2FCODE%3E%3C%2FLI%3E%0A%3CLI%3EAssign%20the%20AzureAD%26nbsp%3B%3CSTRONG%3E%24aadConnector%26nbsp%3B%3C%2FSTRONG%3Evalue%20and%20remember%20it%20is%20case%20sensitive%3A%26nbsp%3B%3CBR%20%2F%3E%26nbsp%3B%0A%3CPRE%3E%24aadConnector%20%3D%20%22%26lt%3Binsert%20AzureAD%20connector%20name%20here%26gt%3B%22%3C%2FPRE%3E%0A%26nbsp%3B%3C%2FLI%3E%0A%3CLI%3E%3CSPAN%3EInstall%20the%20AzureAD%20Sync%20module%3A%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%0A%3CPRE%3EImport-Module%20ADSync%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%20%3CSPAN%3ECreate%20a%20new%20ForceFullPasswordSync%20configuration%20parameter%20object%3C%2FSPAN%3E%3A%26nbsp%3B%3CBR%20%2F%3E%26nbsp%3B%0A%3CPRE%3E%24c%20%3D%20Get-ADSyncConnector%20-Name%20%24adConnector%3C%2FPRE%3E%0A%26nbsp%3B%3C%2FLI%3E%0A%3CLI%3EUpdate%20the%20existing%20connector%20with%20the%20following%20new%20configuration.%20Remember%20to%20enter%20each%20line%20separately%3A%26nbsp%3B%3CBR%20%2F%3E%26nbsp%3B%0A%3CPRE%3E%24p%20%3D%20New-Object%20Microsoft.IdentityManagement.PowerShell.ObjectModel.ConfigurationParameter%20%22Microsoft.Synchronize.ForceFullPasswordSync%22%2C%20String%2C%20ConnectorGlobal%2C%20%24null%2C%20%24null%2C%20%24null%0A%24p.Value%20%3D%201%3C%2FPRE%3E%0A%3CPRE%3E%24c.GlobalParameters.Remove(%24p.Name)%3C%2FPRE%3E%0A%3CPRE%3E%24c.GlobalParameters.Add(%24p)%3C%2FPRE%3E%0A%3CPRE%3E%24c%20%3D%20Add-ADSyncConnector%20-Connector%20%24c%3C%2FPRE%3E%0A%26nbsp%3B%3C%2FLI%3E%0A%3CLI%3EDisable%20Azure%20AD%20Connect%3A%3CBR%20%2F%3E%0A%3CPRE%3ESet-ADSyncAADPasswordSyncConfiguration%20-SourceConnector%20%24adConnector%20-TargetConnector%20%24azureadConnector%20-Enable%20%24false%3C%2FPRE%3E%0A%26nbsp%3B%3C%2FLI%3E%0A%3CLI%3ERe-enable%20Azure%20AD%20Connect%20to%20force%20a%20full%20password%20synchronization%3A%3CBR%20%2F%3E%0A%3CPRE%3ESet-ADSyncAADPasswordSyncConfiguration%20-SourceConnector%20%24adConnector%20-TargetConnector%20%24azureadConnector%20-Enable%20%24true%3C%2FPRE%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSPAN%3ESynchronization%20of%20legacy%20password%20hashes%20to%20Azure%20AD%20may%20take%20some%20time%20and%20depend%20on%20directory%20size%20in%20terms%20of%20number%20of%20accounts%20and%20groups.%20Once%20completed%2C%20the%20passwords%20are%20synchronized%20to%20the%20to%20Azure%20AD%20followed%20by%20syncing%20to%20the%20Azure%20AD%20DS%20managed%20domain.%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EMicrosoft%20also%20provides%20a%20great%20document%20entitled%20%3CSTRONG%3E%3CA%20title%3D%22Troubleshoot%20password%20hash%20synchronization%26nbsp%3Bwith%20Azure%20AD%20Connect%20sync%22%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Factive-directory%2Fhybrid%2Ftshoot-connect-password-hash-synchronization%3FWT.mc_id%3DITOPSTALK-blog-abartolo%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3ETroubleshoot%20password%20hash%20synchronization%26nbsp%3Bwith%20Azure%20AD%20Connect%20sync%3C%2FA%3E%3C%2FSTRONG%3E%20which%20details%20additional%20tactics%20to%20address%20possible%20sync%20issues.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-900063%22%20slang%3D%22en-US%22%3E%3CP%3EAfter%20reading%20the%20previous%20%3CA%20title%3D%22PowerShell%20Basics%3A%20How%20to%20Force%20AzureAD%20Connect%20to%20Sync%22%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FITOps-Talk-Blog%2FPowerShell-Basics-How-to-Force-AzureAD-Connect-to-Sync%2Fba-p%2F887043%3FWT.mc_id%3DITOPSTALK-blog-abartolo%22%20target%3D%22_blank%22%20rel%3D%22noopener%22%3EPowerShell%20Basics%20article%3C%2FA%3E%2C%20some%20from%20the%20ITPRO%20community%20have%20reached%20out%20inquiring%20how%20to%20force%20the%20sync%20of%20only%20passwords%20and%20not%20the%20entire%20contents%20of%20Active%20Directory.%26nbsp%3B%20It%20appears%20the%20ask%20comes%20in%20light%20of%20troubleshooting%20Office%20365%20password%20sync%20issues.%26nbsp%3B%20This%20post%20will%20focus%20on%20steps%20to%20address%20this%20via%20PowerShell.%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F134944iD72B3B0B8F4E0886%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22PowerShell_Basics.jpg%22%20title%3D%22PowerShell_Basics.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-900063%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAnthony%20Bartolo%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAzure%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPowerShell%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Microsoft

Before starting this post, the team would like to thank all the contributions shared by the PowerShell community found on Reddit for their support on exploring PowerShell automation capabilities.  The outpouring of suggestions and sharing of scripts was awesome and has resulted in another question asked for us as a community to address.

 

After reading the previous PowerShell Basics article, some from the ITPRO community have reached out inquiring how to force the sync of only passwords and not the entire contents of Active Directory.  It appears the ask comes in light of troubleshooting Office 365 password sync issues.  This post will focus on steps to address this via PowerShell.
 
Lets begin.

 

  1. Run PowerShell
     
    How_to_Force_a_Full_Password_Sync_in_AzureAD_Connect_001.pngRun PowerShell Force AzureAD Password Sync
     
  2. Assign the local Active Directory $adConnector value and remember it is case sensitive: 
     
    $adConnector = "<insert local connector name here>"
  3. Assign the AzureAD $aadConnector value and remember it is case sensitive: 
     
    $aadConnector = "<insert AzureAD connector name here>"
     
  4. Install the AzureAD Sync module:
     
    Import-Module ADSync

     

  5. Create a new ForceFullPasswordSync configuration parameter object
     
    $c = Get-ADSyncConnector -Name $adConnector
     
  6. Update the existing connector with the following new configuration. Remember to enter each line separately: 
     
    $p = New-Object Microsoft.IdentityManagement.PowerShell.ObjectModel.ConfigurationParameter "Microsoft.Synchronize.ForceFullPasswordSync", String, ConnectorGlobal, $null, $null, $null
    $p.Value = 1
    $c.GlobalParameters.Remove($p.Name)
    $c.GlobalParameters.Add($p)
    $c = Add-ADSyncConnector -Connector $c
     
  7. Disable Azure AD Connect:
    Set-ADSyncAADPasswordSyncConfiguration -SourceConnector $adConnector -TargetConnector $azureadConnector -Enable $false
     
  8. Re-enable Azure AD Connect to force a full password synchronization:
    Set-ADSyncAADPasswordSyncConfiguration -SourceConnector $adConnector -TargetConnector $azureadConnector -Enable $true

Synchronization of legacy password hashes to Azure AD may take some time and depend on directory size in terms of number of accounts and groups. Once completed, the passwords are synchronized to the to Azure AD followed by syncing to the Azure AD DS managed domain.

 

Microsoft also provides a great document entitled Troubleshoot password hash synchronization with Azure AD Connect sync which details additional tactics to address possible sync issues.