# Password complexity should be enabled

Password complexity requirements are a fundamental security control that helps prevent weak passwords:

Source: https://maester.dev/docs/tests/AD-PWDPOL-04

<!-- 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/soulemike" title="Michael Soule · Original author"><img src="https://github.com/soulemike.png" alt="Michael Soule" width="28" height="28" loading="lazy" decoding="async" /></a></div><div class="test-byline-meta"><span class="test-byline-text">Contributed by <a href="/contributors/soulemike">Michael Soule</a></span><a class="test-byline-link" href="/contributors">All contributors →</a></div></div>

<p class="test-part">Part of <a href="/docs/tests/ad">Active Directory</a> · Active Directory · Password policy · <a href="/docs/tests">All checks</a></p>

```powershell title="Run this check"
Invoke-Maester -TestId AD-PWDPOL-04
```

## Overview

Password complexity requirements are a fundamental security control that helps prevent weak passwords:

* **Prevents common passwords**: Complexity requirements block easily guessable passwords like "password123" or "companyname2024"
* **Increases entropy**: Character diversity increases the search space for brute-force attacks
* **Meets compliance requirements**: Most security frameworks require password complexity

Complexity alone is not sufficient—length is equally important. The best approach combines both: long passwords (14+ characters) with complexity requirements.

#### Control Type

**Preventive**

#### Security Recommendation

**Enable password complexity requirements** to ensure passwords contain characters from at least three of these categories:
* Uppercase letters (A-Z)
* Lowercase letters (a-z)
* Numbers (0-9)
* Special characters (!@#$%^&*, etc.)

To configure this setting:
1. Open **Group Policy Management**
2. Navigate to the Default Domain Policy
3. Edit: Computer Configuration > Policies > Windows Settings > Security Settings > Account Policies > Password Policy
4. Enable **Password must meet complexity requirements**

#### How the Test Works

This test retrieves the default domain password policy using `Get-ADDefaultDomainPasswordPolicy` and checks the `ComplexityEnabled` property. The test reports:
* Whether complexity is currently enabled or disabled
* Recommended setting (Enabled)
* Whether the configuration meets security best practices

#### Related Tests

- `Test-MtAdPasswordHistoryCount` - Checks password history enforcement
- `Test-MtAdPasswordMaxAge` - Checks maximum password age
- `Test-MtAdPasswordMinLength` - Checks minimum password length

## Details

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

| Field | Value |
| --- | --- |
| Test ID | AD-PWDPOL-04 |
| Severity | Medium |
| Suite | Active Directory |
| Product | Active Directory |
| Feature | Password policy |
| Area | Authentication |
| Resource type | Tenant |
| User impact | Medium |
| Implementation cost | Low |
| MITRE ATT&CK | T1110 Brute Force |
| PowerShell test | [Test-MtAdPasswordComplexityRequired](https://github.com/maester365/maester/blob/main/tests/ad/password-policy/Test.AD-PWDPOL-04.ps1) |
| Services | ActiveDirectory |
| Permissions | ActiveDirectory:Ldap:domainDNS.pwdProperties:ReadProperty |

</details>

## Source

- Test: [`tests/ad/password-policy/Test.AD-PWDPOL-04.ps1`](https://github.com/maester365/maester/blob/main/tests/ad/password-policy/Test.AD-PWDPOL-04.ps1)
- Documentation: [`tests/ad/password-policy/Test.AD-PWDPOL-04.md`](https://github.com/maester365/maester/blob/main/tests/ad/password-policy/Test.AD-PWDPOL-04.md)
