# All Conditional Access policies are configured to exclude Directory/OnPremises synchronization accounts or do not scope them

Microsoft Entra Connect uses a connector identity to synchronize an on-premises directory with Microsoft Entra ID.

Source: https://maester.dev/docs/tests/MT.1020

<!-- This file is generated by website/scripts/generate-test-docs.mjs. Do not edit manually. -->

<div class="test-byline"><div class="test-byline-avatars"><a class="test-byline-avatar test-byline-avatar--author" href="/contributors/f-bader" title="Fabian Bader · Original author"><img src="https://github.com/f-bader.png" alt="Fabian Bader" width="28" height="28" loading="lazy" decoding="async" /></a><a class="test-byline-avatar" href="/contributors/merill" title="Merill Fernando · Co-contributor"><img src="https://github.com/merill.png" alt="Merill Fernando" width="28" height="28" loading="lazy" decoding="async" /></a><a class="test-byline-avatar" href="/contributors/weycc81" title="Stefan Wey · Co-contributor"><img src="https://github.com/weyCC81.png" alt="Stefan Wey" width="28" height="28" loading="lazy" decoding="async" /></a><a class="test-byline-avatar" href="/contributors/samerde" title="Sam Erde · Co-contributor"><img src="https://github.com/SamErde.png" alt="Sam Erde" width="28" height="28" loading="lazy" decoding="async" /></a><a class="test-byline-avatar" href="/contributors/mynster9361" title="-Mynster · Co-contributor"><img src="https://github.com/Mynster9361.png" alt="-Mynster" width="28" height="28" loading="lazy" decoding="async" /></a><a class="test-byline-avatar" href="/contributors/jhope188" title="Jon Hope · Co-contributor"><img src="https://github.com/Jhope188.png" alt="Jon Hope" width="28" height="28" loading="lazy" decoding="async" /></a><span class="test-byline-avatar test-byline-more">+1</span></div><div class="test-byline-meta"><span class="test-byline-text">Contributed by <a href="/contributors/f-bader">Fabian Bader</a> with 6 co-contributors</span><a class="test-byline-link" href="/contributors">All contributors →</a></div></div>

<p class="test-part">Part of <a href="/docs/tests/maester">Maester</a> · Entra ID · Conditional Access · <a href="/docs/tests">All checks</a></p>

```powershell title="Run this check"
Invoke-Maester -TestId MT.1020
```

## Overview

Microsoft Entra Connect uses a connector identity to synchronize an on-premises directory with Microsoft Entra ID.
Legacy installations can use a user-based directory synchronization account. These accounts should be excluded from
Conditional Access policies scoped to all cloud apps and all users, and their access should be restricted to trusted
networks.

New installations of Microsoft Entra Connect 2.5.76.0 or later use application-based authentication by default, with a
service principal and certificate instead of a user account and password. Existing installations do not switch to
application-based authentication automatically.

This test evaluates user principals assigned to the directory synchronization roles. It passes automatically when no
user principals remain, because Conditional Access user exclusions do not apply to service principals; the test does not
need to be muted. To verify the authentication method currently used, run Get-ADSyncEntraConnectorCredential on every
Microsoft Entra Connect server and confirm that ConnectorIdentityType is Application. After verifying the migration,
remove the legacy directory synchronization account or remove its directory synchronization role assignment.

#### Remediation action

Review the configuration described above.

## Details

<details>
<summary>Every attribute of this check</summary>

| Field | Value |
| --- | --- |
| Test ID | MT.1020 |
| Severity | Medium |
| Suite | Maester |
| Product | Entra ID |
| Feature | Conditional Access |
| Area | Access control |
| Resource type | ConditionalAccessPolicy |
| User impact | Low |
| Implementation cost | Low |
| MITRE ATT&CK | None |
| PowerShell test | [Test-MtCaExclusionForDirectorySyncAccount](https://github.com/maester365/maester/blob/main/tests/maester/entra/Test.MT.1020.ps1) |
| Services | Graph |
| Compatible licenses | AAD_PREMIUM |

</details>

## Source

- Test: [`tests/maester/entra/Test.MT.1020.ps1`](https://github.com/maester365/maester/blob/main/tests/maester/entra/Test.MT.1020.ps1)
- Documentation: [`tests/maester/entra/Test.MT.1020.md`](https://github.com/maester365/maester/blob/main/tests/maester/entra/Test.MT.1020.md)
