Redacting account numbers before they reach Azure OpenAI
Redact account numbers by enforcing policy in the request path, so every prompt, retrieved document and tool output is inspected and transformed before the call leaves your environment. Combine pattern matching, checksum validation and contextual detection, choose redaction or tokenization for each use case, and record evidence that the control ran on each request.
Evidence and evaluation criteria
- Runs before the request leaves your environment, with no path that bypasses it
- Combines pattern, checksum and contextual detection, and shows error rates on your own data
- Covers system prompts, history, retrieved documents and tool outputs, not only user messages
- Supports allow, redact, mask, block and, if needed, tokenize, configured per policy and entity type
- Records policy applied, entity types detected, action taken and timestamp for every decision, without storing the raw account number
- Exports evidence in a durable form with configurable retention, and can run in your own cloud
Where account numbers enter Azure OpenAI request paths
A chat request is rarely just the text a user typed. Account numbers reach the model through several routes: user messages, system prompts that embed customer context, conversation history that is resent with every turn, documents returned by retrieval in a RAG pipeline, and the output of tools or functions that the application feeds back into the next call. Attachments and pasted spreadsheets add structured data to the same path.
This breadth matters for scoping. One federal acquisition text defines LLM data inputs to include user prompts, system prompts, documents, knowledge bases and user account information. Treat that as a useful scoping list even if the text does not apply to you. Enforcement that only inspects the latest user message leaves most of these routes open.
The regulatory framing is also direct. 16 CFR 314.2 gives account numbers as an example of personally identifiable financial information, as of November 2026. Whether Part 314 applies to your organization is a question for counsel. Once a request leaves your environment, you depend on the downstream service's handling of it, and reviewing logs afterward cannot undo that exposure. Before choosing controls, draw a data-flow diagram of every point where account data can join a model request. NIST IR 8505 recommends this kind of mapping for account data.
Detection techniques and their trade-offs
Pattern matching is the starting point, and it is not sufficient alone. NIST IR 8505 notes that regex cannot perform the logical computations needed for validations such as the checksum in credit card numbers. A regex for sixteen digits will flag order numbers and tracking IDs, and it can miss numbers written with unusual spacing or separators.
Checksum validation narrows candidates. For payment cards, a Luhn check removes most random digit strings. Many bank, policy and customer identifiers have no public checksum, so for those you rely on format rules, length and context.
Contextual detection uses nearby words such as "account", "policy" or "routing" to raise or lower confidence. NIST IR 8505 warns that keyword-proximity detection can produce false positives and considerable noise if it is not managed. ML-based classification is described as potentially the most effective automatic method, but it needs significant setup and management.
A workable design layers these signals. Pattern matching proposes candidates, checksums validate where a checksum exists, context and optional ML scoring adjust confidence, and policy sets thresholds per entity type. No published rate will tell you how this performs on your traffic, so measure false positives and false negatives on your own prompts and documents before setting any block threshold.
Choosing where enforcement runs
Detection quality is only half the problem. The other half is whether the control sits where every request must pass. NIST IR 8505 describes payload-level enforcement in the request path, using modules that apply policy to HTTP payloads. The comparison below is design analysis to validate in your environment, not measured results.
- Application code or library: Easy to start and close to business context. Each application must adopt it correctly, so behavior drifts across teams, and any code path that calls the model directly bypasses it.
- API management layer: Gives one routing point for traffic that is sent through it. Policies there are often limited to header and simple payload rules, and clients that call the endpoint another way are not covered.
- In-path policy enforcement: Inspects and acts on the request payload before it is forwarded, independent of the calling application. Adds a processing step to each call, so latency and failure behavior need testing, and network rules should prevent direct calls.
Redaction, masking, tokenization, and the RAG problem
Redaction replaces the value with a type label such as an account-number placeholder. It is the simplest option and leaves nothing to reverse, but the model loses the ability to distinguish one account from another. Masking keeps part of the value, commonly the last four digits. That helps a user recognize the account, but partial values can still be identifying in some contexts, so the policy should say which entities may be masked.
Tokenization replaces the value with a surrogate and stores the mapping inside your environment. The model can reason about "the same account" across a conversation, and the application can restore the real value in the response after it returns. The cost is a token store that must itself be protected, and tokens must not be derivable from the original value.
Multi-turn conversations need a consistent rule. Because history is resent, apply the same transformation to every request, and use stable tokens within a session if you tokenize. For RAG, redacting at index time helps but does not cover content added later, so inspect retrieved passages again at request time. Treat tool outputs the same way: they are data produced by other systems and can carry account numbers into the next prompt unnoticed. Where a policy cannot safely transform content, blocking the request is a valid action.
How Trussed enforces policy in this path
Trussed enforces policy in the execution path, across models, agents, tools and MCP servers. For a request headed to a model, policy decides to allow, redact or block, and it applies to individual interactions and tool calls. This is enforced at runtime, not reviewed after the fact.
Each enforcement decision produces audit-ready evidence, mapped to HIPAA, NAIC, NYDFS, the EU AI Act and NIST. Trussed can be deployed self-managed in the customer cloud, with configurable retention and data residency. It has run continuously in production at a regulated enterprise for more than 18 months, with 99.95% uptime on live production traffic.
Use the criteria above to test it, or any alternative, against your own prompts, documents and tool outputs.
Redaction in the execution path
1. Inspect
Scan prompts, history, retrieved content and tool outputs.
2. Detect
Pattern, checksum and context signals identify account numbers.
3. Enforce
Policy decides to allow, redact or block the request.
4. Evidence
Each decision records policy, entity types, action and time.
Test enforcement against your own request paths
Walk through where account numbers enter your Azure OpenAI traffic and what evidence each enforcement decision should produce.
Request a DemoHow does your AI governance program compare?
See where your program has gaps in less than 2 minutes.