Home Cloud Azure Manually Force an AzureAD Sync

Manually Force an AzureAD Sync

2883
0
Reading Time: 3 minutes

In this blog post, I will cover how to force an AzureAD Sync from our on-premise AD Domain to the Azure Active Directory. For Reference, this is the error message which can be found in the O365 Admin Portal

Next, we need to connect to the Windows Server which is running the AzureAD Sync Service. For my ad.hypervlab.co.uk environment, I’ve created a dedicated server called ‘hypervlab-as01’ Once connected we will want to import the ADSync PowerShell Module.

Import ADSync Module

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

ADSync Commands.

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Cmdlet          Add-ADSyncAADServiceAccount                        1.0.0.0    ADSync
Cmdlet          Add-ADSyncAttributeFlowMapping                     1.0.0.0    ADSync
Cmdlet          Add-ADSyncConnector                                1.0.0.0    ADSync
Cmdlet          Add-ADSyncConnectorAnchorConstructionSettings      1.0.0.0    ADSync
Cmdlet          Add-ADSyncConnectorAttributeInclusion              1.0.0.0    ADSync
Cmdlet          Add-ADSyncConnectorHierarchyProvisioningMapping    1.0.0.0    ADSync
Cmdlet          Add-ADSyncConnectorObjectInclusion                 1.0.0.0    ADSync
Cmdlet          Add-ADSyncGlobalSettingsParameter                  1.0.0.0    ADSync
Cmdlet          Add-ADSyncJoinConditionGroup                       1.0.0.0    ADSync
Cmdlet          Add-ADSyncRule                                     1.0.0.0    ADSync
Cmdlet          Add-ADSyncRunProfile                               1.0.0.0    ADSync
Cmdlet          Add-ADSyncRunStep                                  1.0.0.0    ADSync
Cmdlet          Add-ADSyncScopeConditionGroup                      1.0.0.0    ADSync
Cmdlet          Add-AgentToResourceGroup                           1.0.0.0    ADSync
Cmdlet          Disable-ADSyncConnectorPartition                   1.0.0.0    ADSync
Cmdlet          Disable-ADSyncConnectorPartitionHierarchy          1.0.0.0    ADSync
Cmdlet          Disable-ADSyncExportDeletionThreshold              1.0.0.0    ADSync
Cmdlet          Enable-ADSyncConnectorPartition                    1.0.0.0    ADSync
Cmdlet          Enable-ADSyncConnectorPartitionHierarchy           1.0.0.0    ADSync
Cmdlet          Enable-ADSyncExportDeletionThreshold               1.0.0.0    ADSync
Cmdlet          Get-ADSyncAADCompanyFeature                        1.0.0.0    ADSync
Cmdlet          Get-ADSyncAADPasswordResetConfiguration            1.0.0.0    ADSync
Cmdlet          Get-ADSyncAADPasswordSyncConfiguration             1.0.0.0    ADSync
Cmdlet          Get-ADSyncADConnectorSchemaDsml                    1.0.0.0    ADSync
Cmdlet          Get-ADSyncAutoUpgrade                              1.0.0.0    ADSync
Cmdlet          Get-ADSyncConnector                                1.0.0.0    ADSync
Cmdlet          Get-ADSyncConnectorHierarchyProvisioningDNCompo... 1.0.0.0    ADSync
Cmdlet          Get-ADSyncConnectorHierarchyProvisioningMapping    1.0.0.0    ADSync
Cmdlet          Get-ADSyncConnectorHierarchyProvisioningObjectC... 1.0.0.0    ADSync
Cmdlet          Get-ADSyncConnectorParameter                       1.0.0.0    ADSync
Cmdlet          Get-ADSyncConnectorPartition                       1.0.0.0    ADSync
Cmdlet          Get-ADSyncConnectorPartitionHierarchy              1.0.0.0    ADSync
Cmdlet          Get-ADSyncConnectorRunStatus                       1.0.0.0    ADSync
Cmdlet          Get-ADSyncConnectorStatistics                      1.0.0.0    ADSync
Cmdlet          Get-ADSyncConnectorTypes                           1.0.0.0    ADSync
Cmdlet          Get-ADSyncCSObject                                 1.0.0.0    ADSync
Cmdlet          Get-ADSyncCSObjectLog                              1.0.0.0    ADSync
Cmdlet          Get-ADSyncDatabaseConfiguration                    1.0.0.0    ADSync
Cmdlet          Get-ADSyncExportDeletionThreshold                  1.0.0.0    ADSync
Cmdlet          Get-ADSyncGlobalSettings                           1.0.0.0    ADSync
Cmdlet          Get-ADSyncGlobalSettingsParameter                  1.0.0.0    ADSync
Cmdlet          Get-ADSyncMVObject                                 1.0.0.0    ADSync
Cmdlet          Get-ADSyncPartitionPasswordSyncState               1.0.0.0    ADSync
Cmdlet          Get-ADSyncRule                                     1.0.0.0    ADSync
Cmdlet          Get-ADSyncRunProfile                               1.0.0.0    ADSync
Cmdlet          Get-ADSyncScheduler                                1.0.0.0    ADSync
Cmdlet          Get-ADSyncSchedulerConnectorOverride               1.0.0.0    ADSync
Cmdlet          Get-ADSyncSchema                                   1.0.0.0    ADSync
Cmdlet          Get-ADSyncServerConfiguration                      1.0.0.0    ADSync
Cmdlet          Invoke-ADSyncCSObjectPasswordHashSync              1.0.0.0    ADSync
Cmdlet          Invoke-ADSyncRunProfile                            1.0.0.0    ADSync
Cmdlet          New-ADSyncConnector                                1.0.0.0    ADSync
Cmdlet          New-ADSyncJoinCondition                            1.0.0.0    ADSync
Cmdlet          New-ADSyncRule                                     1.0.0.0    ADSync
Cmdlet          New-ADSyncRunProfile                               1.0.0.0    ADSync
Cmdlet          New-ADSyncScopeCondition                           1.0.0.0    ADSync
Cmdlet          Register-Agent                                     1.0.0.0    ADSync
Cmdlet          Remove-ADSyncAADPasswordResetConfiguration         1.0.0.0    ADSync
Cmdlet          Remove-ADSyncAADPasswordSyncConfiguration          1.0.0.0    ADSync
Cmdlet          Remove-ADSyncAADServiceAccount                     1.0.0.0    ADSync
Cmdlet          Remove-ADSyncAttributeFlowMapping                  1.0.0.0    ADSync
Cmdlet          Remove-ADSyncConnector                             1.0.0.0    ADSync
Cmdlet          Remove-ADSyncConnectorAnchorConstructionSettings   1.0.0.0    ADSync
Cmdlet          Remove-ADSyncConnectorAttributeInclusion           1.0.0.0    ADSync
Cmdlet          Remove-ADSyncConnectorHierarchyProvisioningMapping 1.0.0.0    ADSync
Cmdlet          Remove-ADSyncConnectorObjectInclusion              1.0.0.0    ADSync
Cmdlet          Remove-ADSyncGlobalSettingsParameter               1.0.0.0    ADSync
Cmdlet          Remove-ADSyncJoinConditionGroup                    1.0.0.0    ADSync
Cmdlet          Remove-ADSyncRule                                  1.0.0.0    ADSync
Cmdlet          Remove-ADSyncRunProfile                            1.0.0.0    ADSync
Cmdlet          Remove-ADSyncRunStep                               1.0.0.0    ADSync
Cmdlet          Remove-ADSyncScopeConditionGroup                   1.0.0.0    ADSync
Cmdlet          Search-ADSyncDirectoryObjects                      1.0.0.0    ADSync
Cmdlet          Set-ADSyncAADCompanyFeature                        1.0.0.0    ADSync
Cmdlet          Set-ADSyncAADPasswordResetConfiguration            1.0.0.0    ADSync
Cmdlet          Set-ADSyncAADPasswordSyncConfiguration             1.0.0.0    ADSync
Cmdlet          Set-ADSyncAADPasswordSyncState                     1.0.0.0    ADSync
Cmdlet          Set-ADSyncAutoUpgrade                              1.0.0.0    ADSync
Cmdlet          Set-ADSyncConnectorParameter                       1.0.0.0    ADSync
Cmdlet          Set-ADSyncDirSyncConfiguration                     1.0.0.0    ADSync
Cmdlet          Set-ADSyncGlobalSettings                           1.0.0.0    ADSync
Cmdlet          Set-ADSyncScheduler                                1.0.0.0    ADSync
Cmdlet          Set-ADSyncSchedulerConnectorOverride               1.0.0.0    ADSync
Cmdlet          Set-ADSyncSchema                                   1.0.0.0    ADSync
Cmdlet          Set-ADSyncServerConfiguration                      1.0.0.0    ADSync
Cmdlet          Set-MIISADMAConfiguration                          1.0.0.0    ADSync
Cmdlet          Start-ADSyncAADPasswordResetEndpoint               1.0.0.0    ADSync
Cmdlet          Start-ADSyncPurgeRunHistory                        1.0.0.0    ADSync
Cmdlet          Start-ADSyncSyncCycle                              1.0.0.0    ADSync
Cmdlet          Stop-ADSyncAADPasswordResetEndpoint                1.0.0.0    ADSync
Cmdlet          Stop-ADSyncRunProfile                              1.0.0.0    ADSync
Cmdlet          Stop-ADSyncSyncCycle                               1.0.0.0    ADSync
Cmdlet          Test-AdSyncAzureServiceConnectivity                1.0.0.0    ADSync
Cmdlet          Test-ADSyncGetDirectoryReplicationChanges          1.0.0.0    ADSync
Cmdlet          Test-AdSyncUserHasPermissions                      1.0.0.0    ADSync
Cmdlet          Update-ADSyncConnectorPartition                    1.0.0.0    ADSync
Cmdlet          Update-ADSyncConnectorSchema                       1.0.0.0    ADSync
Cmdlet          Update-ADSyncDirectoryObject                       1.0.0.0    ADSync
Cmdlet          Update-ADSyncDRSCertificates                       1.0.0.0    ADSync
Cmdlet          Update-ADSyncPartitions                            1.0.0.0    ADSync

Before we Initiate a Force Sync lets check when the next sync time is scheduled:

Get-ADSyncScheduler

Notice that the bottom value “SyncCycleInProgress” is currently False

Start-ADSyncSyncCycle -PolicyType Initial -Verbose

After we have initiated the force sync we can check back to see what the Scheduler is doing:

As you can see the value “SyncCycleInProgress” has now changed to “True” if we swap back to the Office Admin Portal we can see that now the last directory sync was 3 minutes ago.

LEAVE A REPLY

Please enter your comment!
Please enter your name here