# Build and tune custom sensitive information types

- URL: https://m365playbooks.com/playbooks/build-and-tune-custom-sensitive-information-types/
- Topic: Data Loss Prevention (Program)
- Product: Purview, Exchange, SharePoint, Teams, Copilot
- Stage: Prepare
- Last reviewed: October 18, 2026
- Version: 2
- Prepared by: Sev Derghazarian

## Overview

Built-in sensitive information types find credit card and passport numbers, but not the identifiers that matter most to your organization: employee and client numbers, case and claim references, internal project codes. A custom sensitive information type lets DLP, auto-labelling and the other Purview solutions find them. The aim is a type precise enough that an alert means something; one that fires on every nine-digit number trains people to ignore DLP.

Technically, you write a specification and a synthetic test set with the data owner, choose between a pattern-based type and an exact data match type, design confidence tiers with supporting keywords and proximity, then build the type in the Purview portal or as a PowerShell rule package. You test it against the set, run it in a simulation-mode DLP policy, and record each version in a register before DLP policies depend on it.

- You'll end up with: A tested, versioned custom type for each of your identifiers, with a data owner, a register entry and a false positive rate the DLP analyst has accepted.
- Duration: 1 to 3 weeks per type
- Effort: About 2 to 5 person-days per type
- Complexity: Medium
- Who's in the room: Purview admin, data owner for the identifier, DLP analyst
- Beyond E5: Nothing beyond Microsoft 365 E5
- If you skip it: Your own identifiers go undetected, or a loose pattern floods DLP with false positives and people stop trusting the alerts.

## Before you start

- [Decide what counts as sensitive](https://m365playbooks.com/playbooks/decide-what-counts-as-sensitive/)
- **Write a specification for the identifier** Before anyone writes a regex, have the data owner describe the identifier: its exact format and length, any fixed prefix, whether it has a check digit and how it's calculated, the words that usually appear near it ("employee number", "matter"), and where it lives (email, documents, exports from operational systems). Ask also for what looks like it but isn't: phone numbers, order numbers, another system's IDs with the same shape.
- **Build a synthetic test set** Make two lists and a few documents: valid samples in every format variant, look-alikes that must not match, and test files that mimic how the identifier really appears (a form, a spreadsheet). Generate the values; with a check digit, valid samples pass it and some look-alikes fail it. Never copy real identifiers into test files, tickets or tools.
- Pattern or exact data match?

  **Decision: Pattern or exact data match?** Recommended default: Exact data match type, where a system of record holds the values.
  A pattern-based type describes what an identifier looks like. An exact data match (EDM) type compares content against one-way hashes of the actual values from a system of record, which is far more precise and lets you require other fields from the same record, such as a name, near the number. EDM needs more setup and refreshed data. Use it for identifiers whose true values you hold; use a pattern for formats you can only describe.
  Other options: Pattern-based custom type. Decided by: Purview admin with the data owner.

## Test to sign-off

### 1. Agree the specification (2 to 3 days)

The data owner signs off the format, look-alikes and keywords, and the synthetic test set built from them.

- Who: Data owner with the Purview admin
- Produces: A signed-off specification and synthetic test set
- Move on when: The specification and synthetic test set are approved

- **If you** Test with real identifiers. What tends to happen: The test files, tickets and chat threads become a leak of the data you're trying to protect.. A better approach: Generate synthetic values that follow the format and pass any check digit.

- [ ] Does every identifier have a specification signed off by its data owner?
- [ ] Is the test set synthetic, with look-alikes as well as valid samples?

### 2. Design the type (1 to 2 days)

Turn the specification into a pattern design: what counts as low, medium and high confidence, which keywords support a match, and how close they must be.

- Who: Purview admin with the DLP analyst
- Produces: A pattern design with tiers, keywords and proximity
- Move on when: The design covers every format variant in the specification

**Decision: How should confidence be tiered?** Recommended default: Three tiers, with corroborating evidence for high.
Each pattern has a confidence level: low (65), medium (75) or high (85). A common design is the format alone at low, the format plus a checksum or validator at medium, and both plus a supporting keyword nearby at high. Proximity sets how many characters either side of the match supporting evidence can be. Start with a narrow proximity window; a wide one lets unrelated keywords count as evidence. DLP rules then choose a level: high confidence with low instance counts, low confidence only with higher counts.
Other options: One pattern at a single level. Decided by: Purview admin with the DLP analyst.

- **If you** Write a pattern that only describes the shape, such as nine digits. What tends to happen: It matches phone numbers, order numbers and dates, analysts stop reviewing alerts, and the type gets switched off.. A better approach: Add a validator or additional checks, and keep high confidence for matches with a supporting keyword nearby.

### 3. Build and test against the set (3 to 5 days)

Build the type and run it against the samples and look-alikes until the results match the design.

- Who: Purview admin
- Produces: A type that matches every valid sample at the intended level and no look-alikes
- Move on when: Every valid sample matches at the intended level and no look-alike reaches medium

**How to do it:** Create the type in the Purview portal, or as a rule package in Security & Compliance PowerShell when you need options the portal lacks or want the definition under version control. Purview uses the Boost.RegEx 5.1.3 engine and checks patterns when you save: one capturing group only, no `^` or `$` anchors, at most 1,024 characters, and no unbounded repeats on a group. Test samples and look-alikes with the portal's sample-file test, which reports matches by confidence level, and with Test-DataClassification for quick text checks. Narrow false positives with a validator (Luhn, checksum or date), additional checks such as excluded values or prefixes, or a stricter boundary, then retest.

- [ ] Does each type match every valid sample at the intended level and no look-alikes?

### 4. Run a DLP policy in simulation (up to 15 days)

Use the type in a simulation-mode policy on real locations, and review a sample of the matches with the DLP analyst.

- Who: DLP analyst with the Purview admin
- Produces: A false positive rate the DLP analyst accepts
- Move on when: The DLP analyst reviews a sample of matches and accepts the false positive rate

- [ ] Has the type run in a simulation-mode policy with an accepted false positive rate?

### 5. Version, record and hand over (1 day)

Record the type in the register, plan reclassification of existing content, and hand it to the DLP rollout.

- Who: Purview admin
- Produces: A recorded, versioned type ready for DLP policies
- Move on when: The register entry is complete and the owner approves

**How to do it:** Record each type's specification, design, test results and owner in a register. If you use rule packages, raise the version number on every upload, or Purview won't deploy the change. Keep within the limits, such as 20 regular expressions per type and 2,048 keyword terms. Stored content isn't checked against a new or changed type until it's classified again: when it's next edited, when the site is recrawled, or by an on-demand classification scan. That scan targets chosen types and a date range, shows a cost estimate first and is billed pay-as-you-go. Assume the locations that matter need reclassifying whenever you change a format, keywords or confidence levels. Endpoint DLP evaluates every type in the tenant, so a slow pattern affects devices even before a policy uses it. Then hand it to the DLP Deploy playbook.

- **If you** Change a type that live policies already use without retesting. What tends to happen: Every policy that uses it changes at once, and a broken pattern can stop matching or start flooding without anyone noticing.. A better approach: Retest against the saved test set before every change and record the version in the register.

- [ ] Is each type recorded with its version, test results and owner?
- [ ] Has existing content in the locations that matter been reclassified, by recrawl or on-demand classification?

**What keeps it in place:** A sensitive information type detects; it doesn't block anything. Enforcement comes from the DLP, auto-labelling or retention policies that use it, which is why the type is tested here before any policy depends on it.

## How you'll know it's working

Capture a baseline before you start, or you won't be able to show the change.

- DLP matches on the type confirmed as true positives (Where you see it: DLP alerts and Activity explorer; Good direction: Up)
- Matches marked "Not a match" in feedback (Where you see it: Content explorer and the type's matched items; Good direction: Down)
- Changes shipped without a passing test run (Where you see it: The type register; Good direction: Down)

**Ready-to-use text: Custom type specification**

> Identifier: [name]
> Data owner: [name]
> Format and length: [e.g. two letters, then seven digits; optional hyphen after the letters]
> Check digit: [none / position and algorithm]
> Words usually nearby: [e.g. employee number, emp no, badge]
> Where it appears: [email, documents, exports, systems]
> Look-alikes that must not match: [e.g. phone numbers, PO numbers, other system IDs]
> System of record holding the values: [system, or none]
> Intended use: [DLP / auto-labelling / retention / other]

**Ready-to-use text: Tuning log entry**

> Date | Type | Version | What changed | Why (false positive or missed match) | Test set result | Approved by

## Microsoft Learn

**Plan:**

- [Learn about sensitive information types](https://learn.microsoft.com/en-us/purview/sit-sensitive-information-type-learn-about)
- [Learn about exact data match based sensitive information types](https://learn.microsoft.com/en-us/purview/sit-learn-about-exact-data-match-based-sits)
- [Sensitive information type limits](https://learn.microsoft.com/en-us/purview/sit-limits)

**Configure:**

- [Create custom sensitive information types in the Microsoft Purview portal](https://learn.microsoft.com/en-us/purview/sit-create-a-custom-sensitive-information-type)
- [Create a custom sensitive information type using PowerShell](https://learn.microsoft.com/en-us/purview/sit-create-a-custom-sensitive-information-type-in-scc-powershell)
- [Sensitive information type regular expression validators and additional checks](https://learn.microsoft.com/en-us/purview/sit-regex-validators-additional-checks)

**Monitor:**

- [Test-DataClassification](https://learn.microsoft.com/en-us/powershell/module/exchangepowershell/test-dataclassification)
- [On-demand classification](https://learn.microsoft.com/en-us/purview/on-demand-classification)
- [Learn about DLP simulation mode](https://learn.microsoft.com/en-us/purview/dlp-simulation-mode-learn)

## Changelog

- Version 2, 2026-11-19, Sev Derghazarian: Restructured into phases: decisions, how-to, pitfalls and checks now sit with the phase they belong to. Added problems this solves and its place after Decide what counts as sensitive. No facts changed.
- Version 1, 2026-10-18, Sev Derghazarian: First version. Facts checked against Microsoft Learn on 2026-10-18.
