Blog Post

ITOps Talk Blog
1 MIN READ

PowerShell Basics: How to Force AzureAD Connect to Sync

AnthonyBartolo's avatar
Oct 03, 2019

In every organization, the possibility of role changes or change of contact information can occur quite frequently. AzureAD Connect is a great tool that allows administrators to make said updates either on-premises or in cloud and will sync all changes accordingly. It can take up to 30 minutes for Azure Active Directory to update these changes when these changes are applied on the on-premises Active Directory instance and vice-versa via AzureAD Connect. It can also take up to an additional 30 minutes to then sync changes with Office 365. This post will detail steps to force AzureAD Connect to sync on command when required via PowerShell to combat the delay.

   

Lets begin.

   

  1. Run PowerShell
     
    Run PowerShell
     
  2. Run the following command to install the AzureAD Sync module:
     
    Import-Module ADSync
  3. Next lets review the current intervals AzureAD Connect uses to sync by running the following command.
     
    Get-ADSyncScheduler
    NOTE: The report should show intervals of 30 minute syncs and a sync policy type of Delta. A sync policy type of Initial is usually shown after AzureAD Connect's initial sync but can also be forced as detailed in the next step.
     
  4. Now run the following command to initialize the AzureAD Sync immediately.
     
    Start-ADSyncSyncCycle -PolicyType Delta
    NOTE: This will only sync current changes.  Run the following command to force a complete sync but note that the length of sync time would be greatly increased.
     
    Start-ADSyncSyncCycle -PolicyType Initial

Other customized commands can be applied to AzureAD Connect to conduct specific synchronization tasks.  These additional commands are documented here: Azure AD Connect sync: Understand and customize synchronization.

 

Updated Nov 24, 2023
Version 12.0
  • Charlie_WSL the module is included when you install AzureAD Connect.

    You do need to run these commands on the machine that has AzureAD connect installed (or you can use enter-pssession or invoke-command to run it remotely)

  • Emdad1's avatar
    Emdad1
    Copper Contributor

    For the ADSync module, on the computer that has AzureAD Connect installed, run the command below.

     

    Import-Module -Name "C:\Program Files\Microsoft Azure AD Sync\Bin\ADSync"

     

  • Charlie_WSL's avatar
    Charlie_WSL
    Copper Contributor

    Dumb question, but where do I get the ADSync Module.  

     

    I've installed the ADSyncTools module, but this seems to be different

  • pro tip: this also works via Remote PowerShell

    Server Manager > right click on your Entra ID Sync Server > PowerShell > enter the cmdlets.