Entra ID has the "Directory Synchronization Accounts built-in role assigned to the Entra service account(s) that "Microsoft Entra Connect" (formerly "Azure AD Connect") or "Microsoft Entra Cloud Sync" (formerly "Azure AD Connect Cloud Sync") uses to allow directory synchronization from the on-premises Active Directory to the cloud Entra ID.
Attackers can assign this role to a security principal - such as User, Service Principal, or Group - that they control in order to gain privilege escalation or persistence. In particular, this role can interest attackers for the following reasons:
This potential of abuse was described in this Tenable Research blogpost: Stealthy Persistence with "Directory Synchronization Accounts" Role in Entra ID
This Indicator of Exposure employs multiple heuristics to detect suspicious security principals that have this risky role assigned, especially when they don't align with typical Entra service accounts for Microsoft Entra Connect or Microsoft Entra Cloud Sync.
Begin by evaluating the legitimacy of the identified suspicious security principal:
If you suspect a breach:
Neither the "Directory Synchronization Accounts" role nor its assignees are visible in the Azure portal. To view them, you must use other methods such as the Microsoft Graph PowerShell cmdlets or the API directly:
Connect-MgGraph -Scopes "RoleManagement.Read.All"
Get-MgDirectoryRoleMember -DirectoryRoleId (Get-MgDirectoryRole -Filter "RoleTemplateId eq 'd29b2b05-8046-44ba-8758-1e26182fcf32'").Id | Format-List *
Or alternatively using the now deprecated Azure AD PowerShell cmdlets:
Connect-AzureAD
Get-AzureADDirectoryRole -Filter "RoleTemplateId eq 'd29b2b05-8046-44ba-8758-1e26182fcf32'" | Get-AzureADDirectoryRoleMember
Finally, if the identified security principal does not have a legitimate reason to have this assigned role, and Microsoft Entra Connect or Microsoft Entra Cloud Sync does not use it, you should remove this role assignment. You can do this either with the Remove-AzureADDirectoryRoleMember
Azure AD PowerShell cmdlet, or the Remove-MgDirectoryRoleMemberByRef
Microsoft Graph PowerShell cmdlet.
Name: Suspicious "Directory Synchronization Accounts" Role Assignment
Codename: SUSPICIOUS-DIRECTORY-SYNCHRONIZATION-ACCOUNTS-ROLE-ASSIGNMENT
Severity: High