Data Loss Prevention · Playbook 2 of 6 · Prepare
Build and tune custom sensitive information types
Specify, build and test custom sensitive information types for your own identifiers, and tune them until a match is worth acting on.
- Duration
- 1 to 3 weeks per type
- Effort
- About 2 to 5 person-days per type
- Complexity
- Medium
- Beyond E5
- Nothing beyond Microsoft 365 E5
On this page
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.
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
The path to this playbook
- 1. Decide what counts as sensitive
- 2. Build and tune custom sensitive information types (you are here)
- Playbook 1, Decide what counts as sensitive: A short, owned register of sensitive information categories, the control level each justifies, and an exception process.
- Write a specification for the identifier
How to do it
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
How to do it
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.
Test to sign-off
5 phases · 1 decisionAgree the specification2 to 3 days
The data owner signs off the format, look-alikes and keywords, and the synthetic test set built from them.
Move on when The specification and synthetic test set are approved
Watch out for (1)
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.
Design the type1 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.
Move on when The design covers every format variant in the specification
Key decisions for this phase (1)
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.
Watch out for (1)
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.
Build and test against the set3 to 5 days
Build the type and run it against the samples and look-alikes until the results match the design.
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.Run a DLP policy in simulationup 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.
Move on when The DLP analyst reviews a sample of matches and accepts the false positive rate
Version, record and hand over1 day
Record the type in the register, plan reclassification of existing content, and hand it to the DLP rollout.
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.
Watch out for (1)
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.
How you'll know it's working
3 measures
Capture a baseline before you start, or you won't be able to show the change.
| Measure | Where you see it | Good direction |
|---|---|---|
| DLP matches on the type confirmed as true positives | DLP alerts and Activity explorer | Up |
| Matches marked "Not a match" in feedback | Content explorer and the type's matched items | Down |
| Changes shipped without a passing test run | The type register | Down |
Take it with you
plan, decisions, gate checks, 2 templates
Plan outline: phases and when to move on
- Agree the specification (2 to 3 days). Move on when: The specification and synthetic test set are approved
- Design the type (1 to 2 days). Move on when: The design covers every format variant in the specification
- Build and test against the set (3 to 5 days). Move on when: Every valid sample matches at the intended level and no look-alike reaches medium
- Run a DLP policy in simulation (up to 15 days). Move on when: The DLP analyst reviews a sample of matches and accepts the false positive rate
- Version, record and hand over (1 day). Move on when: The register entry is complete and the owner approves
Decisions to record, with the recommended answer
| Decision | Recommended default | Our choice |
|---|---|---|
| Pattern or exact data match? | Exact data match type, where a system of record holds the values | |
| How should confidence be tiered? | Three tiers, with corroborating evidence for high |
Gate checks: questions to answer before each phase ends
Before leaving Agree the specification
- 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?
Before leaving Build and test against the set
- Does each type match every valid sample at the intended level and no look-alikes?
Before leaving Run a DLP policy in simulation
- Has the type run in a simulation-mode policy with an accepted false positive rate?
Before leaving Version, record and hand over
- 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?
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]
Tuning log entry
Date | Type | Version | What changed | Why (false positive or missed match) | Test set result | Approved by
Microsoft Learn
9 links
Plan
Configure
Contributors

Microsoft 365 architecture and governance · Protiviti

Microsoft 365 security and compliance · Protiviti
Compare notes or suggest an improvement
Changelog
Changelog (2 versions)
| Version | Date | By | Change |
|---|---|---|---|
| 2 | 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. | |
| 1 | Sev Derghazarian | First version. Facts checked against Microsoft Learn on 2026-10-18. |