Harden Entra Connect and Cloud Sync: A Step-by-Step Guide
Summary
Microsoft Entra Connect synchronizes Active Directory users, groups and password hashes to Microsoft Entra ID, so its server and accounts can change identities in both directories. Harden hybrid identity by treating every sync server as Tier 0, restricting the connector accounts, moving to application-based authentication, rolling over the Seamless SSO key and limiting writeback.
Quick steps
- Run the two read-only audit scripts: one on each sync server, one against the Active Directory forest.
- Limit administrator access to every sync server, staging servers included, as you would for a domain controller.
- Upgrade to version 2.6.84.0 or later before April 7, 2027; the latest build is safer.
- Switch the Microsoft Entra connector to application-based authentication and remove the old sync account.
- Lock down the AD DS Connector account, and remove its replication rights if you don't use password hash sync.
- Block soft match and hard match takeover in the tenant.
- Roll over the
AZUREADSSOACCKerberos key at least every 30 days and move the account to AES. - Alert on sync setting changes, sync account sign-ins and directory replication requests.
Applies to: Microsoft Entra Connect Sync 2.x and the Microsoft Entra Cloud Sync provisioning agent, with password hash synchronization, pass-through authentication or federation (as of November 2026). The scripts run in Windows PowerShell 5.1.
What is Microsoft Entra Connect and why is the sync server Tier 0?
Microsoft Entra Connect is the on-premises Microsoft application that synchronizes identities from Active Directory to Microsoft Entra ID and configures how hybrid users sign in. Its former name is Azure AD Connect. Hybrid identity means one person has an account in both directories, as our glossary on Microsoft Entra ID vs Active Directory explains. Microsoft Entra Cloud Sync does the same job with a lightweight agent whose configuration lives in the cloud.
Microsoft's Entra Connect prerequisites say the server must be treated as a Tier 0 component and hardened as a Control Plane asset. They also explain why: an attacker who controls the server can manipulate users in Microsoft Entra ID, for example by resetting a password. Microsoft's security operations guidance adds that staging servers are Tier 0 too.
The on-premises side is just as sensitive. With password hash sync, the connector account holds the replication rights that a DCSync attack uses, MITRE ATT&CK T1003.006, OS Credential Dumping: DCSync. Changing how the tenant validates hybrid sign-ins is T1556.007, Modify Authentication Process: Hybrid Identity, which our hybrid identity backdoor rules watch.
Microsoft Threat Intelligence's Storm-0501 report (August 27, 2025) shows both sides. The actor compromised an Entra Connect Sync server, ran DCSync, used the Directory Synchronization Account to enumerate the tenant, and reset the on-premises password of a synced Global Administrator that had no MFA method. Password hash sync carried the new password to the cloud.
Which accounts does hybrid identity use?
Microsoft Entra Connect uses three accounts, and the features around it add more. Microsoft's accounts and permissions reference describes each one:
| Account | Where it lives | What it can do | How to protect it |
|---|---|---|---|
AD DS Connector account (MSOL_ prefix with express settings) |
Users container of the forest root domain | Reads and writes Active Directory; holds Replicating Directory Changes and Replicating Directory Changes All for password hash sync, and Reset password for writeback | Step 4 |
| ADSync service account | The sync server: a virtual service account by default, a group managed service account with a remote SQL Server, or an AAD_ user |
Runs the sync engine; it stores the passwords of the other accounts encrypted, with keys protected by DPAPI | Step 2; it can be set only at installation |
| Microsoft Entra connector identity | Microsoft Entra ID: a Sync_<server>_<id> user with the Directory Synchronization Accounts role, or an application with a certificate |
Writes objects and password hashes to the tenant | Step 3 |
| Hybrid Identity Administrator | Microsoft Entra role | Manages Entra Connect, pass-through authentication, password hash sync, Seamless SSO and federation settings | Needed for setup; Microsoft suggests a lower role afterward |
AZUREADSSOACC computer account |
Each Active Directory forest with Seamless SSO | Its Kerberos key lets Microsoft Entra ID decrypt sign-in tickets | Step 6 |
Cloud Sync gMSA (provAgentgMSA$) |
The Active Directory domain | Runs the Cloud Sync agent with the same permission types as the connector account | Cloud Sync section |
Each sync server, staging servers included, has its own Microsoft Entra connector account, and a tenant can have at most 20 sync service accounts. As of November 2026, the built-in roles reference marks the Directory Synchronization Accounts role "Do not use" and lists only one read permission for it.
Before you start
Plan the work as a Tier 0 change: inventory every sync server, confirm who can make each change, and save the current configuration first. Test every step on a staging server or in a lab forest and tenant first, because a wrong permission change can stop synchronization.
- Find every server. List the Microsoft Entra Connect Sync servers, staging servers, Cloud Sync agents and pass-through authentication agents. Each one is in scope.
- Permissions. On the sync server you need local Administrator and ADSyncAdmins membership. The ADSyncConfig cmdlets that set permissions need an Enterprise Admin, or a Domain Admin in each domain. The Seamless SSO key rollover needs a Domain Admin and a Hybrid Identity Administrator. Microsoft Graph's onPremisesSynchronization API supports only the Global Administrator role, for reads and updates.
- Save the configuration. In the wizard, open Tasks > View or export current configuration, and keep the export with your change record.
- Pause synchronization during changes. Run
Set-ADSyncScheduler -SyncCycleEnabled $falsebefore a change andSet-ADSyncScheduler -SyncCycleEnabled $trueafterward. - Tools. The ADSync module is on the sync server. ADSyncConfig ships with Entra Connect and needs the Active Directory module (RSAT). AzureADSSO is in the Entra Connect folder, and the tenant step uses Microsoft Graph PowerShell.
Step 1: Audit the current state
Start with an inventory of the sync servers, the Active Directory permissions and the tenant settings. The two scripts below are read-only, and the Graph commands only read.
Audit each sync server
This script reads the version, how the Entra connector authenticates, the scheduler and auto-upgrade state, the ADSync service account, the connector accounts, the local administrators and the TPM. It changes nothing and reads no password or key. Run it in an elevated Windows PowerShell 5.1 session on every Microsoft Entra Connect Sync server, as a local administrator who belongs to ADSyncAdmins.
#Requires -Version 5.1
#Requires -RunAsAdministrator
#Requires -Modules ADSync
<#
.SYNOPSIS
Read-only audit of a Microsoft Entra Connect Sync server: version, connector identity, scheduler, accounts and local administrators.
.DESCRIPTION
Run it on every Microsoft Entra Connect Sync server, staging servers included. It reads:
- the product version of AzureADConnect.exe, compared with MinimumVersion;
- how the Microsoft Entra connector signs in (ServiceAccount or Application);
- the scheduler state and the auto-upgrade state;
- the account that runs the ADSync service;
- the AD DS connectors and, when the ADSyncConfig module loads, their connector accounts;
- the members of the local Administrators group and of the ADSyncAdmins group;
- whether a TPM is present and ready.
Each result is one row with Check, Value and Finding. The script writes one CSV file and
returns the rows. It reads no password, key or private key and changes nothing.
.PARAMETER OutputPath
Path of the CSV report, for example 'C:\Reports\EntraConnect\sync01-server-audit.csv'.
.PARAMETER MinimumVersion
Lowest Microsoft Entra Connect Sync version you accept. Microsoft requires 2.6.84.0 or later
by April 7, 2027 (as of November 2026); raise it when you standardize on a newer build.
.EXAMPLE
.\Get-EntraConnectServerAudit.ps1 -OutputPath 'C:\Reports\EntraConnect\sync01-server-audit.csv'
.EXAMPLE
.\Get-EntraConnectServerAudit.ps1 -OutputPath 'C:\Reports\EntraConnect\sync02-server-audit.csv' -MinimumVersion '2.6.92.0'
.NOTES
Read-only. Makes no change on the server, in Active Directory or in Microsoft Entra ID.
Writes only the CSV report. Run it in an elevated Windows PowerShell 5.1 session on the
Microsoft Entra Connect Sync server, as a local administrator who is a member of ADSyncAdmins.
The ADSyncConfig part needs the Active Directory module (RSAT) on the server; without it,
that row reports 'Not checked'.
#>
[CmdletBinding()]
param(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]$OutputPath,
[ValidateNotNullOrEmpty()]
[version]$MinimumVersion = '2.6.84.0'
)
Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
$reportFolder = Split-Path -Path $OutputPath -Parent
if ($reportFolder -and -not (Test-Path -Path $reportFolder -PathType Container)) {
throw "Report folder not found: $reportFolder"
}
$rows = New-Object System.Collections.Generic.List[object]
function Add-Row {
param([string]$Check, [string]$Value, [string]$Finding = '')
$rows.Add([pscustomobject]@{
Server = $env:COMPUTERNAME
Check = $Check
Value = $Value
Finding = $Finding
})
}
# 1. Product version of AzureADConnect.exe
$candidates = @(
(Join-Path -Path $env:ProgramFiles -ChildPath 'Microsoft Azure Active Directory Connect\AzureADConnect.exe'),
(Join-Path -Path $env:ProgramFiles -ChildPath 'Microsoft Azure AD Connect\AzureADConnect.exe')
)
$exe = $candidates | Where-Object { Test-Path -Path $_ -PathType Leaf } | Select-Object -First 1
if ($exe) {
$productVersion = [version](Get-Item -Path $exe).VersionInfo.ProductVersion
if ($productVersion -lt $MinimumVersion) { $finding = "Upgrade: below $MinimumVersion" }
else { $finding = 'OK: check its end of support date in the version history' }
Add-Row -Check 'Microsoft Entra Connect Sync version' -Value $productVersion.ToString() -Finding $finding
}
else {
Add-Row -Check 'Microsoft Entra Connect Sync version' -Value 'AzureADConnect.exe not found' -Finding 'Review: check the version in Programs and Features'
}
# 2. How the Microsoft Entra connector authenticates
try {
$identityType = [string](Get-ADSyncEntraConnectorCredential).ConnectorIdentityType
if ($identityType -eq 'Application') { $finding = 'OK: application-based authentication' }
else { $finding = 'Fix: move to application-based authentication before April 7, 2027' }
Add-Row -Check 'Microsoft Entra connector identity' -Value $identityType -Finding $finding
}
catch {
Add-Row -Check 'Microsoft Entra connector identity' -Value 'Get-ADSyncEntraConnectorCredential unavailable' -Finding 'Upgrade: this build predates application-based authentication'
}
# 3. Scheduler and auto-upgrade
$scheduler = Get-ADSyncScheduler
Add-Row -Check 'Scheduler SyncCycleEnabled' -Value ([string]$scheduler.SyncCycleEnabled)
Add-Row -Check 'Scheduler StagingModeEnabled' -Value ([string]$scheduler.StagingModeEnabled) -Finding $(if ($scheduler.StagingModeEnabled) { 'Staging server: harden it like the active server' } else { '' })
Add-Row -Check 'Scheduler SchedulerSuspended' -Value ([string]$scheduler.SchedulerSuspended) -Finding $(if ($scheduler.SchedulerSuspended) { 'Review: automatic certificate rotation does not run while suspended' } else { '' })
$autoUpgrade = [string](Get-ADSyncAutoUpgrade)
Add-Row -Check 'Auto-upgrade state' -Value $autoUpgrade -Finding $(if ($autoUpgrade -eq 'Suspended') { 'Review: run Get-ADSyncAutoUpgrade -Detail' } else { '' })
# 4. ADSync service account (registry value that Microsoft's own steps read)
$serviceAccount = (Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\ADSync' -Name 'ObjectName').ObjectName
Add-Row -Check 'ADSync service account' -Value $serviceAccount -Finding 'Review: VSA by default, gMSA with a remote SQL Server'
# 5. AD DS connectors and their accounts
foreach ($connector in @(Get-ADSyncConnector | Where-Object { $_.ConnectorTypeName -eq 'AD' })) {
Add-Row -Check 'AD DS connector' -Value $connector.Name
}
$adSyncConfig = Join-Path -Path $env:ProgramFiles -ChildPath 'Microsoft Azure Active Directory Connect\AdSyncConfig\AdSyncConfig.psm1'
try {
Import-Module -Name $adSyncConfig -ErrorAction Stop
foreach ($account in @(Get-ADSyncADConnectorAccount)) {
$text = ($account.PSObject.Properties | ForEach-Object { "$($_.Name)=$($_.Value)" }) -join '; '
Add-Row -Check 'AD DS Connector account' -Value $text -Finding 'Review: must not be a Domain Admin or Enterprise Admin'
}
}
catch {
Add-Row -Check 'AD DS Connector account' -Value 'Not checked' -Finding 'ADSyncConfig did not load (needs the Active Directory module)'
}
# 6. Who administers the server and the sync engine
foreach ($member in @(Get-LocalGroupMember -SID 'S-1-5-32-544')) {
Add-Row -Check 'Local Administrators member' -Value "$($member.Name) [$($member.ObjectClass), $($member.PrincipalSource)]" -Finding 'Review: Tier 0 administrators only'
}
try {
foreach ($member in @(Get-LocalGroupMember -Group 'ADSyncAdmins')) {
Add-Row -Check 'ADSyncAdmins member' -Value "$($member.Name) [$($member.ObjectClass), $($member.PrincipalSource)]" -Finding 'Review: Tier 0 administrators only'
}
}
catch {
Add-Row -Check 'ADSyncAdmins member' -Value 'Group not found' -Finding 'Review: custom sync groups may use another name'
}
# 7. TPM for the application certificate
try {
$tpm = Get-Tpm
$tpmState = "TpmPresent=$($tpm.TpmPresent); TpmReady=$($tpm.TpmReady)"
Add-Row -Check 'TPM' -Value $tpmState -Finding $(if ($tpm.TpmPresent -and $tpm.TpmReady) { 'OK' } else { 'Review: without a TPM the certificate key is software-protected' })
}
catch {
Add-Row -Check 'TPM' -Value 'Get-Tpm failed' -Finding 'Review: check the TPM manually'
}
# 8. Report
$rows | Export-Csv -Path $OutputPath -NoTypeInformation -Encoding UTF8
$rows
.\Get-EntraConnectServerAudit.ps1 -OutputPath 'C:\Reports\EntraConnect\sync01-server-audit.csv'
Example output (the values are illustrative):
Server Check Value Finding
------ ----- ----- -------
SYNC01 Microsoft Entra Connect Sync version 2.6.3.0 Upgrade: below 2.6.84.0
SYNC01 Microsoft Entra connector identity ServiceAccount Fix: move to application-based authentication before April 7, 2027
SYNC01 Scheduler SyncCycleEnabled True
SYNC01 Scheduler StagingModeEnabled False
SYNC01 Scheduler SchedulerSuspended False
SYNC01 Auto-upgrade state Enabled
SYNC01 ADSync service account CORP\gmsa-adsync$ Review: VSA by default, gMSA with a remote SQL Server
SYNC01 AD DS connector corp.example.com
SYNC01 AD DS Connector account Not checked ADSyncConfig did not load (needs the Active Directory module)
SYNC01 Local Administrators member CORP\Domain Admins [Group, ActiveDirectory] Review: Tier 0 administrators only
SYNC01 Local Administrators member CORP\Server Admins [Group, ActiveDirectory] Review: Tier 0 administrators only
SYNC01 ADSyncAdmins member CORP\t0-admin [User, ActiveDirectory] Review: Tier 0 administrators only
SYNC01 TPM TpmPresent=False; TpmReady=False Review: without a TPM the certificate key is software-protected
How to read the results:
- Version and connector identity: both rows above fail the April 7, 2027 requirement. Steps 2 and 3 fix them.
- Local Administrators and ADSyncAdmins: every member controls the sync engine and the credentials it stores. A server admin group that also manages member servers makes those admins Tier 0.
- StagingModeEnabled True: a staging server has its own connector account, and Microsoft treats staging servers as Tier 0 too, so harden it the same way.
Audit the Active Directory side
This script lists every principal that holds both replication rights on each domain object, the AD DS Connector accounts with their password age and group memberships, and the AZUREADSSOACC accounts with their key age, encryption types and delegation settings. It is read-only. Run it from a privileged access workstation with the Active Directory module, as a Tier 0 administrator who can read every domain.
#Requires -Version 5.1
#Requires -Modules ActiveDirectory
<#
.SYNOPSIS
Read-only audit of the Active Directory side of hybrid identity: DCSync rights, AD DS Connector accounts and AZUREADSSOACC.
.DESCRIPTION
For every domain in the current forest, the script reads:
- the access rules on the domain object and lists every principal that holds both
Replicating Directory Changes and Replicating Directory Changes All (the DCSync rights),
directly or through all extended rights or full control;
- the AD DS Connector accounts: every account whose name starts with MSOL_, plus the
accounts named in ConnectorAccount, with password age, last logon and group memberships;
- the AZUREADSSOACC computer account of Seamless SSO: key age (pwdLastSet), Kerberos
encryption types and delegation settings.
Each result is one row with Domain, Check, Object, Value and Finding. The script writes one
CSV file and returns a summary. It reads no password or key and changes nothing.
.PARAMETER OutputPath
Path of the CSV report, for example 'C:\Reports\EntraConnect\ad-hybrid-exposure.csv'.
.PARAMETER ConnectorAccount
sAMAccountName of AD DS Connector accounts that don't start with MSOL_, for example 'svc-adsync'.
.PARAMETER MaxConnectorPasswordAgeDays
Connector account password age that is flagged. Defender for Identity flags 90 days.
.PARAMETER MaxSsoKeyAgeDays
AZUREADSSOACC key age that is flagged. Microsoft recommends a rollover at least every 30 days.
.EXAMPLE
.\Get-HybridIdentityAdExposure.ps1 -OutputPath 'C:\Reports\EntraConnect\ad-hybrid-exposure.csv'
.EXAMPLE
.\Get-HybridIdentityAdExposure.ps1 -OutputPath 'C:\Reports\EntraConnect\ad-hybrid-exposure.csv' -ConnectorAccount 'svc-adsync'
.NOTES
Read-only. Makes no change in Active Directory. Writes only the CSV report.
Run it in Windows PowerShell 5.1 with the Active Directory module (RSAT), from a privileged
access workstation, as a Tier 0 administrator who can read every domain of the forest.
#>
[CmdletBinding()]
param(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]$OutputPath,
[string[]]$ConnectorAccount = @(),
[ValidateRange(1, 3650)]
[int]$MaxConnectorPasswordAgeDays = 90,
[ValidateRange(1, 3650)]
[int]$MaxSsoKeyAgeDays = 30
)
Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
$reportFolder = Split-Path -Path $OutputPath -Parent
if ($reportFolder -and -not (Test-Path -Path $reportFolder -PathType Container)) {
throw "Report folder not found: $reportFolder"
}
$getChanges = [guid]'1131f6aa-9c07-11d1-f79f-00c04fc2dcd2' # DS-Replication-Get-Changes
$getChangesAll = [guid]'1131f6ad-9c07-11d1-f79f-00c04fc2dcd2' # DS-Replication-Get-Changes-All
$extendedRight = [System.DirectoryServices.ActiveDirectoryRights]::ExtendedRight
$inheritOnly = [System.Security.AccessControl.PropagationFlags]::InheritOnly
$now = (Get-Date).ToUniversalTime()
$rows = New-Object System.Collections.Generic.List[object]
function Add-Row {
param([string]$Domain, [string]$Check, [string]$Object, [string]$Value, [string]$Finding = '')
$rows.Add([pscustomobject]@{ Domain = $Domain; Check = $Check; Object = $Object; Value = $Value; Finding = $Finding })
}
function Get-AgeDays {
param($FileTime)
if ($null -eq $FileTime -or [int64]$FileTime -le 0) { return $null }
return [int]($now - [DateTime]::FromFileTimeUtc([int64]$FileTime)).TotalDays
}
$forest = Get-ADForest
$rootDomainSid = (Get-ADDomain -Server $forest.RootDomain).DomainSID.Value
foreach ($domainName in @($forest.Domains)) {
$domain = Get-ADDomain -Server $domainName
$domainSid = $domain.DomainSID.Value
$builtIn = @('S-1-5-18', 'S-1-5-9', 'S-1-5-32-544', "$domainSid-516", "$domainSid-512", "$rootDomainSid-519")
# 1. Principals that hold both replication rights on the domain object (inherit-only entries are skipped)
$entry = New-Object System.DirectoryServices.DirectoryEntry("LDAP://$domainName/$($domain.DistinguishedName)")
$rules = @($entry.ObjectSecurity.GetAccessRules($true, $true, [System.Security.Principal.SecurityIdentifier]) |
Where-Object { $_.AccessControlType -eq 'Allow' -and ($_.ActiveDirectoryRights -band $extendedRight) -and -not ($_.PropagationFlags -band $inheritOnly) })
foreach ($group in @($rules | Group-Object -Property { $_.IdentityReference.Value })) {
$types = @($group.Group | ForEach-Object { $_.ObjectType })
$hasAll = $types -contains [guid]::Empty
if (-not (($hasAll -or $types -contains $getChanges) -and ($hasAll -or $types -contains $getChangesAll))) { continue }
$sid = New-Object System.Security.Principal.SecurityIdentifier($group.Name)
try { $name = $sid.Translate([System.Security.Principal.NTAccount]).Value } catch { $name = $group.Name }
$samName = ($name -split '\\')[-1]
if ($builtIn -contains $group.Name) { $finding = 'Built-in: SYSTEM, domain controllers or administrators' }
elseif ($samName -like 'MSOL_*' -or $ConnectorAccount -contains $samName) { $finding = 'Connector account: needed only for password hash sync' }
else { $finding = 'Review: not SYSTEM, a domain controller group, an administrators group or a connector account' }
Add-Row -Domain $domainName -Check 'DCSync rights on domain object' -Object $name -Value $group.Name -Finding $finding
}
# 2. AD DS Connector accounts
$filters = @('(sAMAccountName=MSOL_*)') + @($ConnectorAccount | ForEach-Object { "(sAMAccountName=$_)" })
$ldapFilter = '(&(objectCategory=person)(objectClass=user)(|' + ($filters -join '') + '))'
foreach ($user in @(Get-ADUser -Server $domainName -LDAPFilter $ldapFilter -Properties pwdLastSet, lastLogonTimestamp, adminCount, memberOf, whenCreated)) {
$age = Get-AgeDays -FileTime $user.pwdLastSet
$lastLogon = if ($user.lastLogonTimestamp) { [DateTime]::FromFileTimeUtc([int64]$user.lastLogonTimestamp).ToString('yyyy-MM-dd') } else { 'never' }
$groups = @($user.memberOf | Where-Object { $_ }).Count
$findings = @()
if ($null -eq $age -or $age -gt $MaxConnectorPasswordAgeDays) { $findings += "Rotate: password older than $MaxConnectorPasswordAgeDays days" }
if ($user.adminCount -eq 1) { $findings += 'Review: adminCount=1 (member of a protected group now or before)' }
if ($groups -gt 0) { $findings += "Review: direct member of $groups group(s)" }
if (-not $user.Enabled) { $findings += 'Review: disabled, remove it if no server uses it' }
Add-Row -Domain $domainName -Check 'AD DS Connector account' -Object $user.SamAccountName -Value "PasswordAgeDays=$age; LastLogon=$lastLogon; Created=$($user.whenCreated.ToString('yyyy-MM-dd'))" -Finding ($findings -join '; ')
}
# 3. Seamless SSO computer account
$sso = @(Get-ADComputer -Server $domainName -LDAPFilter '(sAMAccountName=AZUREADSSOACC$)' -Properties pwdLastSet, userAccountControl, 'msDS-SupportedEncryptionTypes', 'msDS-AllowedToDelegateTo', 'msDS-AllowedToActOnBehalfOfOtherIdentity')
foreach ($computer in $sso) {
$age = Get-AgeDays -FileTime $computer.pwdLastSet
$encTypes = $computer.'msDS-SupportedEncryptionTypes'
$findings = @()
if ($null -eq $age -or $age -gt $MaxSsoKeyAgeDays) { $findings += "Roll over: key older than $MaxSsoKeyAgeDays days" }
if ($null -eq $encTypes -or [int]$encTypes -eq 0) { $findings += 'Review: msDS-SupportedEncryptionTypes not set' }
elseif ([int]$encTypes -band 0x4) { $findings += 'Review: RC4 allowed' }
if (([int]$computer.userAccountControl -band 0x80000) -or ([int]$computer.userAccountControl -band 0x1000000)) { $findings += 'Fix: trusted for delegation' }
if (@($computer.'msDS-AllowedToDelegateTo' | Where-Object { $_ }).Count -gt 0) { $findings += 'Fix: constrained delegation configured' }
if ($null -ne $computer.'msDS-AllowedToActOnBehalfOfOtherIdentity') { $findings += 'Fix: resource-based constrained delegation configured' }
Add-Row -Domain $domainName -Check 'Seamless SSO account' -Object $computer.DistinguishedName -Value "KeyAgeDays=$age; EncryptionTypes=$encTypes" -Finding ($findings -join '; ')
}
if ($sso.Count -eq 0) {
Add-Row -Domain $domainName -Check 'Seamless SSO account' -Object 'AZUREADSSOACC' -Value 'Not found' -Finding ''
}
}
# 4. Report and summary
$rows | Export-Csv -Path $OutputPath -NoTypeInformation -Encoding UTF8
[pscustomobject]@{
Forest = $forest.Name
Domains = @($forest.Domains).Count
DCSyncHolders = @($rows | Where-Object { $_.Check -eq 'DCSync rights on domain object' }).Count
DCSyncHoldersToReview = @($rows | Where-Object { $_.Check -eq 'DCSync rights on domain object' -and $_.Finding -like 'Review*' }).Count
ConnectorAccounts = @($rows | Where-Object { $_.Check -eq 'AD DS Connector account' }).Count
ConnectorFindings = @($rows | Where-Object { $_.Check -eq 'AD DS Connector account' -and $_.Finding }).Count
SsoAccounts = @($rows | Where-Object { $_.Check -eq 'Seamless SSO account' -and $_.Value -ne 'Not found' }).Count
SsoFindings = @($rows | Where-Object { $_.Check -eq 'Seamless SSO account' -and $_.Finding }).Count
Report = $OutputPath
}
.\Get-HybridIdentityAdExposure.ps1 -OutputPath 'C:\Reports\EntraConnect\ad-hybrid-exposure.csv'
Example output (the values are illustrative):
Forest : corp.example.com
Domains : 1
DCSyncHolders : 6
DCSyncHoldersToReview : 1
ConnectorAccounts : 2
ConnectorFindings : 2
SsoAccounts : 1
SsoFindings : 1
Report : C:\Reports\EntraConnect\ad-hybrid-exposure.csv
How to read the CSV:
- DCSync rights, Review: a principal other than SYSTEM, the domain controller groups, the administrators groups and the connector accounts can replicate every password hash. Treat it as a shadow admin and remove the rights unless an owner can justify them.
- Connector account, two accounts: a second
MSOL_account can be left over from a previous server. If no connector uses it, disable it and remove its replication rights. - Seamless SSO account: a key older than 30 days, RC4, or any delegation setting needs the fixes in Step 6.
Read the tenant sync features
The tenant has its own switches for matching and writeback. This read needs a Global Administrator, because Microsoft Graph supports no other role for it:
Connect-MgGraph -Scopes 'OnPremDirectorySynchronization.Read.All', 'RoleManagement.Read.Directory'
Get-MgDirectoryOnPremiseSynchronization | Select-Object -ExpandProperty Features |
Select-Object PasswordSyncEnabled, BlockSoftMatchEnabled, BlockCloudObjectTakeoverThroughHardMatchEnabled, UnifiedGroupWritebackEnabled |
Format-List
$role = Get-MgDirectoryRole | Where-Object { $_.DisplayName -eq 'Directory Synchronization Accounts' }
Get-MgDirectoryRoleMember -DirectoryRoleId $role.Id |
Select-Object Id, @{ Name = 'UserPrincipalName'; Expression = { $_.AdditionalProperties.userPrincipalName } }
PasswordSyncEnabled : True
BlockSoftMatchEnabled : False
BlockCloudObjectTakeoverThroughHardMatchEnabled : False
UnifiedGroupWritebackEnabled : False
Id UserPrincipalName
-- -----------------
00000000-0000-0000-0000-000000000000 Sync_SYNC01_0a1b2c3d4e5f@<tenant>.onmicrosoft.com
00000000-0000-0000-0000-000000000000 Sync_OLDSYNC_9f8e7d6c5b4a@<tenant>.onmicrosoft.com
The second part of each user name is the server name, so an account for a server that no longer exists is a leftover credential. Step 3 removes it.
Step 2: Harden the sync server as a Tier 0 asset
Treat each sync server like a domain controller: few administrators, no daily use, current software.
| Setting | Where | Recommended value | Effect |
|---|---|---|---|
| Local Administrators and ADSyncAdmins | The groups on the server | Domain Admins or another tightly controlled Tier 0 group | Microsoft says to restrict administrative access to domain administrators or other tightly controlled security groups |
| Network security: Restrict NTLM: Outgoing NTLM traffic to remote servers | Computer Configuration\Windows Settings\Security Settings\Local Policies\Security Options | Audit all, then Deny all | Stops the server from using NTLM to remote servers; Microsoft lists it to deny NTLM on the sync server |
| Network security: Restrict NTLM: NTLM authentication in this domain | Same path, in the domain controller policy | A Deny option after auditing | The domain-wide way that Microsoft also lists |
| Local administrator password | Windows LAPS | A unique password per machine | Microsoft lists it for the server |
| Privileged accounts | Active Directory and Microsoft Entra ID | Dedicated admin accounts, privileged access workstations and MFA | MFA stops a password reset made through the sync server from taking over an account |
| TPM | Server hardware, or Security > Enable Trusted Platform Module on a generation 2 Hyper-V VM | On | Keeps the private key of the connector certificate in hardware (Step 3) |
Keep the server out of daily administration: no web browsing or email with its admin accounts, no logon by accounts that aren't Tier 0, and management only through tools that are Tier 0 themselves. The Active Directory hardening guide covers the Tier 0 boundary around it.
Which Microsoft Entra Connect versions are supported?
Version 2.x builds retire 12 months after a newer version is released, and every 1.x version is unsupported and doesn't synchronize. Microsoft also requires version 2.6.84.0 or later, with application-based authentication, by April 7, 2027; after that date synchronization stops on servers that don't meet both conditions. The version release history lists these supported builds (as of November 2026):
| Version | Released | End of support | Meets the April 7, 2027 minimum |
|---|---|---|---|
| 2.6.92.0 | Sep 23, 2026 | Not set (latest) | Yes |
| 2.6.91.0 | Sep 16, 2026 | Sep 23, 2027 | Yes |
| 2.6.84.0 | Jul 7, 2026 | Sep 16, 2027 | Yes |
| 2.6.3.0 | Mar 10, 2026 | Jul 7, 2027 | No |
| 2.6.1.0 | Feb 2, 2026 | Mar 10, 2027 | No |
| 2.5.190.0 | Nov 19, 2025 | Feb 2, 2027 | No |
Install the latest build. Version 2.6.92.0 includes security fixes, and 2.6.84.0 can fail to install over an existing ADSync database, which 2.6.91.0 fixed. New builds are available only from the Microsoft Entra admin center, not the Download Center. Check Get-ADSyncAutoUpgrade too: auto-upgrade installs only the builds that Microsoft releases for it, and not every configuration is eligible.
Step 3: Switch the Microsoft Entra connector to application-based authentication
The legacy connector identity is a user with a password stored on the server. Application-based authentication replaces it with an application that signs in with the OAuth 2.0 client credentials flow and a certificate. Microsoft's application identity article describes three options: Entra Connect manages the application and certificate (the default), you bring the certificate, or you bring both.
With the default option, Entra Connect creates certificates with a 90-day lifetime and rotates them, as long as the scheduler isn't suspended. With a TPM, the key operations run in hardware; without one, the private key is marked nonexportable but protected only by software. New installations use application-based authentication, but Entra Connect doesn't switch existing servers on its own.
- Upgrade the server (Step 2). Manual onboarding needs version 2.5.3.0 or later, but the April 7, 2027 requirement needs 2.6.84.0.
- Start the wizard and select Additional tasks > Configure application-based authentication to Microsoft Entra ID. Follow the prompts with a Hybrid Identity Administrator account.
- Confirm the change on the server:
(Get-ADSyncEntraConnectorCredential).ConnectorIdentityType
Application
- After synchronization works, remove the legacy account. Microsoft strongly recommends this step. The name is the first part of the account's user principal name:
$HACredential = Get-Credential
Remove-ADSyncAADServiceAccount -AADCredential $HACredential -Name 'Sync_SYNC01_0a1b2c3d4e5f' -WhatIf
Drop -WhatIf to delete the account. Repeat the switch on each staging server, because each one has its own legacy sync account.
Two related controls keep the new identity narrow:
- Application Administrator can impersonate the sync application. Microsoft warns that this role can add credentials to the Connect Sync application and sign in as it. Treat it as privileged and make it eligible in Microsoft Entra PIM, together with Hybrid Identity Administrator.
- Conditional Access. Microsoft's Storm-0501 guidance limits legacy Directory Synchronization Accounts to trusted IP addresses. For application-based authentication it uses Conditional Access for workload identities, which needs Microsoft Entra Workload ID (Workload Identities Premium) licenses, as of November 2026. The sync account sign-in rules catch a legacy account used anywhere else.
Step 4: Restrict the AD DS Connector account
The AD DS Connector account needs only the permissions of the features you use, nothing on its own object for other accounts to abuse, and a password that changes. Since build 1.4.x, the wizard refuses an Enterprise Admin or Domain Admin account as the connector account; Defender for Identity, with a sensor on the sync server, flags any that remain.
Microsoft's ADSyncConfig article lists the permissions per feature and the cmdlet that grants each set:
| Feature | Permissions | ADSyncConfig cmdlet |
|---|---|---|
| Basic read (no optional feature) | Read all properties on users, groups, contacts, computers and other synced classes; Replicating Directory Changes on the domain root | Set-ADSyncBasicReadPermissions |
| Password hash sync | Replicating Directory Changes and Replicating Directory Changes All on each domain root | Set-ADSyncPasswordHashSyncPermissions |
| Password writeback | Reset Password and write lockoutTime and pwdLastSet on descendant users |
Set-ADSyncPasswordWritebackPermissions |
| Group writeback | Read, write, create and delete group objects | Set-ADSyncUnifiedGroupWritebackPermissions |
| Exchange hybrid | Read and write all properties on users, groups and contacts | Set-ADSyncExchangeHybridPermissions |
| ms-DS-ConsistencyGuid as source anchor | Read and write that attribute on users | Set-ADSyncMsDsConsistencyGuidPermissions |
Then lock the account object itself. Set-ADSyncRestrictedPermissions disables inheritance on the connector account and removes every access rule except those for SELF. It then grants Full Control to SYSTEM, Enterprise Admins, Domain Admins and Administrators, and read access to Enterprise Domain Controllers and Authenticated Users. Its own help says why: the account has replication permissions on all domains but no protected group shields it.
Save the output of Show-ADSyncADObjectPermissions -ADobjectDN '<connector account DN>' first, then preview the change:
Import-Module "C:\Program Files\Microsoft Azure Active Directory Connect\AdSyncConfig\AdSyncConfig.psm1"
Get-ADSyncObjectsWithInheritanceDisabled -SearchBase 'DC=corp,DC=example,DC=com' -ObjectClass '*'
$credential = Get-Credential
Set-ADSyncRestrictedPermissions -ADConnectorAccountDN 'CN=MSOL_0a1b2c3d4e5f,CN=Users,DC=corp,DC=example,DC=com' -Credential $credential -WhatIf
The first command is read-only: it lists objects with inheritance disabled, which the domain-root permissions don't reach. Grant the feature permissions on those objects with -ADobjectDN, or the sync process reports errors only later. Use an Enterprise Admin or Domain Admin credential that isn't the connector account.
Two more changes come from Defender for Identity's hybrid security assessments:
- No password hash sync, no replication rights. If the tenant doesn't use password hash sync, remove Replicating Directory Changes and Replicating Directory Changes All from the connector account on each domain root, under Security > Advanced in Active Directory Users and Computers. Confirm first that no other application relies on them.
- Rotate the password every 90 days. The assessment flags
MSOL_accounts with an older password. After a reset, enter the new password in Synchronization Service Manager under Connectors > the AD connector > Properties > Connect to Active Directory Forest, then restart the Microsoft Entra ID Sync service.
The same discipline applies to every service account; our post on securing Active Directory service accounts covers it in general.
Step 5: Block soft match and hard match takeover
Matching lets a new on-premises object take over an existing cloud account. A soft match uses the userPrincipalName or primary SMTP address, and a hard match uses the source anchor (ImmutableId). After a takeover, on-premises values overwrite the cloud attributes, including the password hash when password hash sync runs. Microsoft's existing tenant article advises disabling both unless you need them to take over cloud-only accounts.
Since July 1, 2026, Microsoft Entra ID can also block a hard match when the target cloud account holds or is eligible for a privileged role, or already has onPremisesObjectIdentifier set. The check runs in the cloud for both Connect Sync and Cloud Sync, but it doesn't disable hard match. Turn both blocks on as a Global Administrator; Update-MgDirectoryOnPremiseSynchronization supports -WhatIf:
Connect-MgGraph -Scopes 'OnPremDirectorySynchronization.ReadWrite.All'
$onPremSync = Get-MgDirectoryOnPremiseSynchronization
Update-MgDirectoryOnPremiseSynchronization -OnPremisesDirectorySynchronizationId $onPremSync.Id -Features @{ BlockSoftMatchEnabled = $true; BlockCloudObjectTakeoverThroughHardMatchEnabled = $true } -WhatIf
Drop -WhatIf to apply. Turn a block off only for a planned matching job, then on again, as Microsoft advises. The soft match block also stops new hybrid-joined devices from matching (see Troubleshooting).
Matching is one way in; synced privileged accounts are the other. Microsoft strongly recommends against matching on-premises accounts to preexisting cloud admin accounts, and its guidance on protecting Microsoft 365 from on-premises attacks says to use cloud-only accounts for privileged roles. Keep Global Administrator and the emergency access accounts cloud-only, and give synced accounts no privileged cloud roles.
Step 6: Roll over the Seamless SSO key and protect AZUREADSSOACC
Seamless SSO creates the AZUREADSSOACC computer account in each synced forest and shares its Kerberos decryption key with Microsoft Entra ID. Browsers on domain-joined devices request a Kerberos ticket for that account, and Microsoft Entra ID decrypts it with the shared key. A leaked key lets an attacker create tickets for any synced user, so the Seamless SSO FAQ recommends rolling it over at least every 30 days.
Run the rollover on the Entra Connect server with a Domain Admin and a Hybrid Identity Administrator. Import ADSync before AzureADSSO, the order that the 2.6.91.0 release notes require for the standalone module:
Set-Location "$env:ProgramFiles\Microsoft Azure Active Directory Connect"
Import-Module "$env:ProgramFiles\Microsoft Azure AD Sync\Bin\ADSync\ADSync.psd1"
Import-Module .\AzureADSSO.psd1
New-AzureADSSOAuthenticationContext
Get-AzureADSSOStatus | ConvertFrom-Json
$creds = Get-Credential
Update-AzureADSSOForest -OnPremCredentials $creds
New-AzureADSSOAuthenticationContext prompts for the Hybrid Identity Administrator, and Get-AzureADSSOStatus lists the forests under Domains. Enter the Domain Admin as CORP\t0-admin, in SAM account name format, and use an account outside Protected Users, or the operation fails. Run Update-AzureADSSOForest once per forest: a second run stops Seamless SSO until users' Kerberos tickets expire and are reissued. A delegated non-Domain Admin adds -PreserveCustomPermissionsOnDesktopSsoAccount, and staging servers don't need the rollover.
Microsoft's technical deep dive adds rules for the account itself:
- No delegation. Kerberos delegation must be off on the account, and no other account may hold delegation permissions on it. The audit script flags all three delegation types.
- A protected OU. Keep the account in an OU safe from accidental deletion, where only Domain Admins have access.
- AES, not RC4. The July 2026 Windows Server update changes the default Kerberos encryption type in Active Directory from RC4 to AES-256. Roll over the key first, then change
msDS-SupportedEncryptionTypes; changing the type first can break Seamless SSO. Our guide to disabling RC4 and enforcing AES covers the wider change.
Set-ADComputer -Identity 'AZUREADSSOACC' -Server 'corp.example.com' -KerberosEncryptionType 'AES128,AES256' -WhatIf
Seamless SSO works with password hash sync or pass-through authentication, not with AD FS. With Audit Computer Account Management on, a domain controller logs event 4742 for most changes to the account, which the AZUREADSSOACC change rules read; the planned rollover should be the only routine change.
Step 7: Limit password writeback and group writeback
Writeback reverses the direction of trust: a change made in the cloud lands in Active Directory. Enable each kind only where a business need exists, and treat the cloud identities that can trigger it as privileged.
Password writeback. With writeback, a self-service reset and an administrator's reset in the Microsoft Entra admin center or through Microsoft Graph set the on-premises password too. Microsoft states that the writeback service account can't change passwords of users in protected groups, so Domain Admins stay out of reach by default. Service accounts and server administrators outside protected groups don't.
Forestall's documentation describes this cloud-to-on-premises path as the AZ_PASSWORD_WRITEBACK edge. To keep it narrow:
- Keep the writeback permissions off the AdminSDHolder container. ADSyncConfig can extend them there, and Microsoft doesn't recommend it.
- Limit which cloud roles can reset passwords of synced users, and make them eligible in PIM.
- Watch event 4724 with the connector account as the subject; the connector password reset rules tie it to the cloud reset.
Group writeback. Microsoft deprecated the Group Writeback v2 preview of Connect Sync and no longer supports it. Version 1 still writes back Microsoft 365 groups, and Cloud Sync now provisions cloud security groups to Active Directory. A written-back group turns cloud group membership into on-premises access, which Forestall's documentation describes as the AZ_GROUP_WRITEBACK edge. Write groups into a dedicated OU, never nest them into privileged on-premises groups, and treat their owners as privileged identities.
PHS vs PTA vs federation: which hybrid identity sign-in method is safer?
Each method moves a different part of authentication on-premises, and each on-premises part becomes Tier 0. Microsoft's authentication method guide recommends password hash sync in every case, at least as a backup, because ID Protection needs it for leaked credential reports.
| Method | What runs on-premises | What an attacker who controls it gets | Hardening notes |
|---|---|---|---|
| Password hash sync (PHS) | Only the sync server, which reads hashes over directory replication every 2 minutes | DCSync-capable connector account; the ability to set the cloud password of synced users | Microsoft Entra ID stores a PBKDF2 hash of the MD4 hash, so a stolen cloud hash doesn't work for pass-the-hash on-premises |
| Pass-through authentication (PTA) | Authentication agents, three recommended, that check passwords against Active Directory | Every password the agent validates, and the result it returns to Microsoft Entra ID | Treat agent servers like domain controllers; only a Hybrid Identity Administrator can register an agent; no automatic failover to PHS |
| Federation (AD FS or another IdP) | Federation servers and proxies | Tokens for any user of the domain; a stolen token-signing key is Golden SAML | Watch federation settings with the federated domain backdoor rules; Seamless SSO doesn't apply |
If you keep PTA or federation, keep PHS on as the fallback and as the source of leaked credential detection, which our guide on investigating risky users in Entra ID Protection uses. Once no domain is federated, you can retire the federation servers and their Tier 0 footprint.
How is Microsoft Entra Cloud Sync different from Connect Sync?
Cloud Sync moves the configuration and the scheduler to the cloud and leaves only a provisioning agent on-premises. The agent server is still Tier 0: Microsoft's Cloud Sync prerequisites say it should be a Tier 0 server and repeat the Entra Connect hardening list.
| Topic | Microsoft Entra Connect Sync | Microsoft Entra Cloud Sync |
|---|---|---|
| Where the configuration lives | The sync server's SQL database and wizard | Microsoft Entra ID, managed in the admin center |
| Active Directory account | AD DS Connector account (MSOL_ with express settings) |
A gMSA, shown as domain\provAgentgMSA$ |
| Tighten the account's own permissions | Set-ADSyncRestrictedPermissions |
Set-AADCloudSyncRestrictedPermissions |
| Grant feature permissions | ADSyncConfig cmdlets | Set-AADCloudSyncPermissions -PermissionType (BasicRead, PasswordHashSync, PasswordWriteBack and others) |
| High availability | One active server plus staging servers | Several active agents; Microsoft recommends three |
| Updates | Manual or auto-upgrade | The agent updates automatically |
| Group provisioning to Active Directory | Group writeback v1 for Microsoft 365 groups | Supported |
| Device writeback | Supported | Not supported |
The Cloud Sync agent can run on a domain controller. It still needs the same care for its gMSA's permissions, for the Hybrid Identity Administrator who registers it, and for password writeback. Version 2.6.91.0 of Entra Connect added a guided migration to Cloud Sync, available only in the Azure public cloud.
Verify
Rerun the audits and test one sign-in path at a time.
| Check | Expected result |
|---|---|
Get-EntraConnectServerAudit.ps1 on each server |
Version 2.6.84.0 or later, connector identity Application, only Tier 0 members in Administrators and ADSyncAdmins |
Get-HybridIdentityAdExposure.ps1 |
DCSyncHoldersToReview is 0, every connector password is younger than 90 days, every AZUREADSSOACC key is younger than 30 days with no delegation or RC4 finding |
| Graph features | BlockSoftMatchEnabled and BlockCloudObjectTakeoverThroughHardMatchEnabled are True |
| Directory Synchronization Accounts members | No Sync_ account for a server that moved to application-based authentication or no longer exists |
| Wizard: View or export current configuration | The application (client) ID and certificate details; the provider is Microsoft Platform Crypto Provider when the key is in the TPM |
| Seamless SSO test | A test user on a domain-joined device signs in to a cloud app without a password prompt after the rollover |
| Application event log | No certificate warning (event 1011) or expired certificate error (event 1012) |
Roll back
Most changes reverse with the same tools; the Seamless SSO key doesn't.
| Change | How to roll back | Notes |
|---|---|---|
| Application-based authentication | Run Set-ADSyncScheduler -SyncCycleEnabled $false, then Add-ADSyncAADServiceAccount, confirm ConnectorIdentityType is ServiceAccount, and enable the scheduler |
The re-created account can take up to 15 minutes to work, so the first cycle may report Access Denied |
| Removed legacy sync account | The same Add-ADSyncAADServiceAccount command creates a new one |
The deleted account isn't restored |
Set-ADSyncRestrictedPermissions |
Restore inheritance and the access rules from the Show-ADSyncADObjectPermissions output you saved |
No ADSyncConfig cmdlet reverses it |
| Removed replication rights | Set-ADSyncPasswordHashSyncPermissions grants them again (supports -WhatIf) |
Needed only if you turn password hash sync on |
| Soft and hard match blocks | Set the feature to $false for the matching job, then back to $true |
Microsoft's recommended practice |
| Seamless SSO key rollover | Microsoft documents no way to restore the previous key | Plan it as a one-way change, and run it only once per forest in each rollover |
AZUREADSSOACC encryption types |
Set-ADComputer -KerberosEncryptionType with the value the audit recorded |
Roll over the key again if sign-in fails |
| Lowered Hybrid Identity Administrator | Assign the role again before you rerun the wizard | Microsoft advises lowering the role instead of deleting the account, so the wizard can run again |
Monitor and detect
Watch three places: the Microsoft Entra audit log for sync and sign-in method changes, the sign-in logs for the sync accounts, and the domain controllers for replication and account changes.
| Signal | Log | Related pages |
|---|---|---|
| Directory synchronization turned on or off; a sync feature such as a matching block changed | Microsoft Entra audit log: Set DirSyncEnabled flag, Set DirSync feature | KQL 1 below |
| Pass-through authentication or Seamless SSO enabled | Microsoft Entra audit log: Enable passthrough authentication, Enable Desktop Sso | Rules for backdoored hybrid sign-in |
| Federation settings changed | Microsoft Entra audit log: Set federation settings on domain | Federated domain backdoor rules |
| Sync account used outside synchronization | Sign-in logs | Sync account sign-in rules; KQL 2 |
| Replication rights used | Windows Security log: event 4662 | DCSync detection rules; KQL 3 |
| Server instance added to Entra Connect Health | Azure Activity log: Connect Health service member action | Rogue Connect Health server rules |
| Connector certificate near expiry or expired | Application log on the sync server: events 1011 and 1012 | Investigate if the scheduler is suspended |
Event 4662 for a replication request appears only when Audit Directory Service Access is on and the domain object's audit entries match; our guide to Active Directory audit policy sets both up.
The first query returns changes to synchronization, the sign-in method and federation in the last 30 days:
// Changes to directory synchronization, sign-in method and federation settings of the tenant.
// Needs Microsoft Entra audit logs in the AuditLogs table (diagnostic setting).
AuditLogs
| where TimeGenerated > ago(30d)
| where OperationName in (
"Set DirSyncEnabled flag", "Set DirSync feature",
"Enable passthrough authentication", "Disable passthrough authentication",
"Enable Desktop Sso", "Enable Desktop Sso for a specific domain",
"Set domain authentication", "Set federation settings on domain")
| extend Actor = coalesce(tostring(InitiatedBy.user.userPrincipalName), tostring(InitiatedBy.app.displayName))
| mv-apply Target = TargetResources on (summarize Targets = make_set(tostring(Target.displayName)))
| project TimeGenerated, OperationName, Result, Actor, Targets, CorrelationId
| order by TimeGenerated desc
The second query follows Microsoft's Storm-0501 hunting guidance: the legacy sync account normally signs in from one address to three applications.
// Sign-ins of the legacy synchronization accounts to applications the sync service doesn't use.
// Microsoft's Storm-0501 hunting guidance names the display name and the three usual applications.
let SyncApps = dynamic(["Microsoft Azure Active Directory Connect", "Windows Azure Active Directory", "Microsoft Online Syndication Partner Portal"]);
union SigninLogs, AADNonInteractiveUserSignInLogs
| where TimeGenerated > ago(30d)
| where UserDisplayName has "On-Premises Directory Synchronization Service Account"
| where AppDisplayName !in (SyncApps)
| summarize SignIns = count(), FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated), IPAddresses = make_set(IPAddress), Results = make_set(ResultType)
by UserPrincipalName, AppDisplayName, ResourceDisplayName
| order by LastSeen desc
The third query lists every account that used the replication rights. Only domain controller computer accounts and your connector accounts should appear.
// Accounts that exercised the directory replication rights on a domain object (event 4662).
// Needs Audit Directory Service Access on domain controllers and the SecurityEvent table.
// Expect only domain controller computer accounts and your AD DS Connector accounts.
SecurityEvent
| where TimeGenerated > ago(14d)
| where EventID == 4662
| where AccessMask == "0x100"
| where Properties has_any ("1131f6aa-9c07-11d1-f79f-00c04fc2dcd2", "1131f6ad-9c07-11d1-f79f-00c04fc2dcd2")
| summarize Requests = count(), DomainControllers = make_set(Computer), FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated)
by SubjectDomainName, SubjectUserName
| extend IsComputerAccount = SubjectUserName endswith "$"
| order by IsComputerAccount asc, Requests desc
The first query selects records by OperationName alone, so it needs no filter on the Category column of AuditLogs.
Troubleshooting
Most problems after hardening come from credentials that changed in one place only, or from a step run in the wrong order.
| Symptom | Cause | Fix |
|---|---|---|
Imports and exports to Active Directory fail with no-start-credentials, and event 6000 says the credentials were invalid |
The connector account password changed in Active Directory but not in the sync service | Enter the new password in Synchronization Service Manager and restart the Microsoft Entra ID Sync service |
| Access Denied right after rolling back to the legacy account | The re-created sync account isn't active yet | Wait up to 15 minutes, then run a sync cycle |
| The wizard stops: "Microsoft Entra Connect could not configure application-based authentication for this server" | Since 2.6.84.0, setup no longer falls back to the legacy account | Fix the underlying certificate or TPM error and run the wizard again |
| Problems after an upgrade to 2.6.91.0 in a tenant with app-scoped Conditional Access policies | That release added Microsoft Graph permissions to Entra Connect | Review app-scoped Conditional Access policies that target Microsoft.Azure.SyncFabric or Microsoft 365 Reporting Service |
| Seamless SSO stops right after a key rollover | Update-AzureADSSOForest ran more than once in the forest |
Wait until users' Kerberos tickets expire and are reissued |
Update-AzureADSSOForest fails |
The Domain Admin account is in Protected Users | Use a Domain Admin outside Protected Users |
| Seamless SSO fails after the move to AES | The encryption type changed before the key rollover | Roll over the key |
New hybrid-joined devices fail with InvalidSoftMatch |
BlockSoftMatchEnabled is on |
Turn the block off for the join, then on again |
| A hard match to an administrator's cloud account is blocked | The July 2026 protection for privileged targets | Remove the role or eligibility, complete the match, then reassign it |
| The certificate isn't rotated | The scheduler is suspended | Check Get-ADSyncScheduler; rotation runs only while the scheduler runs |
How Forestall helps
Forestall models the paths this guide closes: the DCSync edge shows who holds the replication rights, and the writeback edges show where a cloud password reset or group change reaches Active Directory. Its Tier0 query lists every Tier 0 object across Active Directory, Entra ID and the clouds, and the Hybrid Attack Paths relation preset returns the users with an attack path to one. Attack Path Management maps on-premises and cloud identities into one access graph and detects privilege escalation paths and Shadow Admins.
Frequently Asked Questions
What is Microsoft Entra Connect?
Microsoft Entra Connect is an on-premises Microsoft application that synchronizes users, groups and, optionally, password hashes from Active Directory to Microsoft Entra ID, so one identity works in both directories. It also configures hybrid sign-in: password hash sync, pass-through authentication, federation and Seamless SSO. Microsoft calls Microsoft Entra Cloud Sync, its agent-based alternative managed from the cloud, the future of synchronization.
Is the Entra Connect server a Tier 0 asset?
Yes, Microsoft says the Microsoft Entra Connect server must be treated as a Tier 0 component and hardened as a Control Plane asset, and its security operations guidance includes staging servers. Whoever controls the server can change users in Microsoft Entra ID and, with password hash sync, use the connector account's replication rights. Restrict its administrators to a tightly controlled Tier 0 group.
How often does Entra Connect sync?
Microsoft Entra Connect Sync runs a synchronization cycle every 30 minutes by default, and a changed schedule must still run at least once every 7 days. Password hash synchronization runs separately, every 2 minutes, and that interval can't be changed. Microsoft Entra Cloud Sync uses a scheduler in the cloud that also synchronizes every two minutes.
How do I check which Entra Connect version I run?
To check the Microsoft Entra Connect version, open Control Panel on the sync server and look up Microsoft Entra Connect under Programs > Programs and Features, the method Microsoft's FAQ gives. The audit script in Step 1 reads the product version of AzureADConnect.exe in the Entra Connect folder under C:\Program Files. Compare the version with Microsoft's version release history. As of November 2026, Microsoft requires version 2.6.84.0 or later with application-based authentication by April 7, 2027.
What is the AZUREADSSOACC account?
AZUREADSSOACC is the computer account that Seamless SSO creates in each synchronized Active Directory forest. Its Kerberos decryption key is shared with Microsoft Entra ID, which uses it to read the tickets of users on domain-joined devices. Microsoft recommends rolling over the key at least every 30 days with Update-AzureADSSOForest, disabling delegation on the account and moving it from RC4 to AES.
Is Cloud Sync more secure than Entra Connect Sync?
Microsoft Entra Cloud Sync leaves less on-premises than Connect Sync: a provisioning agent running as a gMSA, with configuration and updates handled by the cloud. It isn't hands-off, though. Microsoft still classifies the agent server as Tier 0, the gMSA can hold password hash sync and writeback permissions, and a Hybrid Identity Administrator registers each agent. Harden the agent servers and restrict the gMSA with Set-AADCloudSyncRestrictedPermissions.
Related guides
- Active Directory hardening, every step in order: the Tier 0 boundary that the sync servers belong to.
- Set up Microsoft Entra PIM: make Hybrid Identity Administrator and Application Administrator eligible instead of permanent.
- Set up break glass accounts in Entra ID: cloud-only emergency accounts that don't depend on synchronization.
- How to secure Active Directory service accounts: the general controls behind the AD DS Connector and ADSync service accounts.
- Microsoft Entra ID security checklist for beginners: where hybrid identity fits among the other tenant controls.
References
- Prerequisites for Microsoft Entra Connect (Microsoft Learn)
- Microsoft Entra Connect: Accounts and permissions (Microsoft Learn)
- Microsoft Entra Connect: Configure AD DS Connector Account Permissions (Microsoft Learn)
- Authenticate to Microsoft Entra ID by using application identity (Microsoft Learn)
- Microsoft Entra Connect: Version release history (Microsoft Learn)
- Configure Microsoft Entra Connect for an existing tenant (Microsoft Learn)
- Microsoft Entra seamless single sign-on: Frequently asked questions (Microsoft Learn)
- Microsoft Entra seamless single sign-on: Technical deep dive (Microsoft Learn)
- Choose the right authentication method for your Microsoft Entra hybrid identity solution (Microsoft Learn)
- Remediate hybrid security posture assessments (Microsoft Defender for Identity, Microsoft Learn)
- Storm-0501's evolving techniques lead to cloud-based ransomware (Microsoft Threat Intelligence)
- OS Credential Dumping: DCSync, T1003.006 (MITRE ATT&CK)
See your identity exposure clearly.
Start with a 1-day Proof of Value in your own environment.