# Computer SPN service class usage should be retrievable

Understanding the distribution of SPN service classes across your computer infrastructure provides valuable security insights:

Source: https://maester.dev/docs/tests/AD-SPN-02

<!-- 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 · Service principal names · <a href="/docs/tests">All checks</a></p>

```powershell title="Run this check"
Invoke-Maester -TestId AD-SPN-02
```

## Overview

Understanding the distribution of SPN service classes across your computer infrastructure provides valuable security insights:

- **Service inventory**: See what services are deployed across your environment
- **Risk assessment**: Identify high-value targets (like database services with SPNs)
- **Compliance tracking**: Ensure only approved services are configured
- **Anomaly detection**: Spot unusual service classes that may indicate shadow IT or misconfigurations

Services with SPNs are targets for Kerberoasting attacks, so knowing which services exist helps prioritize security efforts.

#### Control Type

**Operational**

#### Security Recommendation

Review the service class breakdown regularly:
- Validate that all services with SPNs are authorized
- Ensure sensitive services (MSSQLSvc, etc.) have additional protections
- Remove SPNs for decommissioned services
- Consider implementing SPN attribution monitoring for critical services

#### How the Test Works

This test analyzes all computer SPNs, groups them by service class, and provides a count and percentage for each service class. This gives you a clear view of your Kerberos-authenticated service landscape.

#### Related Tests

- `Test-MtAdComputerSpnServiceClassCount` - Counts distinct service classes
- `Test-MtAdComputerSpnUnknownCount` - Identifies unrecognized service classes
- `Test-MtAdUserSpnServiceClassUsage` - Shows user account SPN service class usage

## Details

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

| Field | Value |
| --- | --- |
| Test ID | AD-SPN-02 |
| Severity | Info |
| Suite | Active Directory |
| Product | Active Directory |
| Feature | Service principal names |
| Area | Infrastructure hardening |
| Resource type | Computer |
| MITRE ATT&CK | None |
| PowerShell test | [Test-MtAdComputerSpnServiceClassUsage](https://github.com/maester365/maester/blob/main/tests/ad/spn/Test.AD-SPN-02.ps1) |
| Services | ActiveDirectory |
| Permissions | ActiveDirectory:Ldap:computer:ReadProperty |

</details>

## Source

- Test: [`tests/ad/spn/Test.AD-SPN-02.ps1`](https://github.com/maester365/maester/blob/main/tests/ad/spn/Test.AD-SPN-02.ps1)
- Documentation: [`tests/ad/spn/Test.AD-SPN-02.md`](https://github.com/maester365/maester/blob/main/tests/ad/spn/Test.AD-SPN-02.md)
