Blog Post

Azure Observability Blog
7 MIN READ

You can't code-review a prompt: redact PII in Azure Monitor logs

Ivan_Varnitski's avatar
Nov 17, 2026

AI apps put user and model text into your telemetry. PII redaction in Azure Monitor (public preview) replaces emails, phone numbers and other identifiers before they reach Log Analytics.

It's 4:45 PM on a Friday, and your support agent has started failing on order lookups. You do the responsible thing and turn on content capture so you can see in Application Insights what it's actually doing. Ten minutes later you have your answer, plus a few things you didn't ask for. A customer pasted their entire email signature into the chat: name, email address, two phone numbers and a cheerful "call me anytime." The model politely promised to do so.

The order tool rejected the request and echoed the full payload into an exception message. Before you know it, your retry logic, being thorough, logged it three more times. By Monday, that phone number lives in your Log Analytics workspace, in your traces, dependency calls and exceptions, plus an alert email and a screenshot in an incident channel with 200 members. Meanwhile, not a single line of your code logs personally identifiable information (PII). You checked. Looks familiar, right?

Nothing went wrong in the code, and that's the problem. "Don't log PII" is a rule for the people who write log statements. In an AI app, most of the text in your telemetry wasn't written by your developers. You can't code-review a prompt.

So the control has to move from the line where telemetry is written to the place where it lands. In this post, we'll show how PII redaction in Azure Monitor, new in public preview at Ignite, does this: it replaces email addresses, phone numbers and other common identifiers during ingestion, before the record is stored in your Log Analytics workspace. We'll also cover what it doesn't do, and how to keep your logs useful once the identifiers are gone.

At a glance

  • What: PII redaction in Azure Monitor masks personally identifiable information and other sensitive data in logs during ingestion, before records reach Log Analytics.
  • Status: public preview, announced at Microsoft Ignite 2026 (November 2026). Apply at aka.ms/pii-redaction-preview.
  • Where it runs: in Azure Monitor log ingestion pipeline, for Application Insights, Azure Monitor Agent and Logs Ingestion API data.
  • What it detects: email addresses, phone numbers, payment card numbers, US Social Security numbers and IPv4 addresses.
  • How it replaces them: a placeholder such as [REDACTED_EMAIL], or a seeded hash that still lets you count and correlate.
  • Cost: standard transformation pricing applies.

Your telemetry has three authors

For most of logging history, whoever wrote your log records worked for you: developers wrote the log templates, picked the fields and argued about them in code review. Logging guidelines are written for this author, and they work reasonably well. If someone adds customer.Email to a log line, a reviewer will probably catch it.

The other two authors are harder to review. Your runtime builds URLs with query strings, fills in tool-call arguments and formats exception messages that often include the input that caused the failure. That's how the phone number from our Friday incident ended up in an exception.

Once you turn on content capture, your users and models write the rest: prompts, responses and retrieved documents go into your traces as they are, and no one reviews that text before it's logged.

Scrubbing at the source still matters, but it can't cover text your developers never wrote. For that you need a rule that runs after all three authors are done and before anyone queries the data, at the point where Azure Monitor receives it. That's where PII redaction in Azure Monitor runs.

New at Ignite: PII redaction in Azure Monitor (public preview)

PII redaction in Azure Monitor adds a new processor, scan.SensitiveInfo, to data collection rule (DCR) transformations. The DCR holds the configuration. The processor runs in the Azure Monitor log ingestion pipeline, which receives data from Application Insights, the Azure Monitor Agent and the Logs Ingestion API.

For each record, the processor scans string values, including strings inside dynamic columns, and replaces matches before the pipeline writes the record to the destination table. Queries, alerts and workbooks that read the table see only the replaced values. If you're new to DCRs and ingestion-time transformations, start with Transformations in Azure Monitor.

Only the arrows into the tables carry redacted values. Anything upstream of the pipeline, including the agent itself and the model it calls, still sees the original text.

What PII redaction detects and how it replaces values

For type IDs, supported formats and default placeholders of the five PII types, see Redact sensitive information in Azure Monitor Logs.

You choose how matches are replaced with the defaultStrategy setting, and you can override it for individual types:

  • obfuscate replaces each match with a placeholder, such as [REDACTED_EMAIL]. You can keep the default placeholder, set your own text for each type, or set an empty string to remove the match.
  • hash replaces each match with a token derived from the value, such as [EMAIL_22ae7fcecdf039d5]. Identical values get identical tokens within a DCR.

Example: a failed agent tool call, redacted

Here's the failed tool call from the opening as a synthetic record, before and after the scan.SensitiveInfo processor:

FieldBeforeAfter
Message
Order tool failed: 400 Bad Request
Order tool failed: 400 Bad Request
Properties["tool.arguments"]
Jordan Lee | jordan.lee@example.com | 425-555-0142 | 425-555-0199 | call me anytime
Jordan Lee | [REDACTED_EMAIL] | [REDACTED_PHONE] | [REDACTED_PHONE] | call me anytime

The error and the shape of the payload survive for debugging. The email address and phone numbers don't. The name does, because none of the five types detects names.

 

Add this transformation to the list in the workspace transformation DCR:

{
  "name": "redactAppTraces",
  "headerProcessor": {
    "processor": "header.StandardStream",
    "configuration": { "streamId": "Microsoft-Table-AppTraces" }
  },
  "processors": [
    {
      "processor": "scan.SensitiveInfo",
      "configuration": {
        "defaultStrategy": "obfuscate",
        "types": ["Email", "PhoneNumber", "CreditCardNumber", "NationalId.US.SSN", "IPAddress.v4"]
      }
    }
  ]
}

The header processor names the input stream. To apply the transformation, set the transform property of the AppTraces data flow to redactAppTraces. The same processor block works in a collection DCR for Azure Monitor Agent and Logs Ingestion API data.

Count without identifying: hashing

Placeholders in PII redaction have a cost: if every email becomes [REDACTED_EMAIL], you can't tell whether 40 failed tool calls came from one customer or from 40. This configuration hashes emails and keeps placeholders for the other types:

{
  "processor": "scan.SensitiveInfo",
  "configuration": {
    "defaultStrategy": "obfuscate",
    "hashSeed": "3f2504e0-4f89-41d3-9a0c-0305e82c3301",
    "types": [
      { "typeId": "Email", "strategy": "hash" },
      "PhoneNumber",
      "CreditCardNumber",
      "NationalId.US.SSN",
      "IPAddress.v4"
    ]
  }
}

Values are normalized first, so Jordan.Lee@Example.com and jordan.lee@example.com get the same token. Tokens are scoped to the DCR by default. To correlate across DCRs, set the same GUID as hashSeed in each; to cut linkage with older data, change it. The seed isn't a secret: anyone who can read the DCR can see it, but it makes de-anonymization of hashed values harder.

With email hashed, you can count affected customers without seeing who they are:

AppTraces
| where TimeGenerated > ago(1d)
| where Message startswith "Order tool failed"
| extend CustomerToken = extract(@"\[EMAIL_[0-9a-f]{16}\]", 0, tostring(Properties))
| where isnotempty(CustomerToken)
| summarize FailedCalls = count(), Customers = dcount(CustomerToken)

In our test, 40 failed calls from three customers with mixed-case emails returned:

FailedCallsCustomers
403

Hashing is pseudonymization: tokens stay linkable, which is what lets you count and correlate. Because they're derived with the seed, or the DCR's ID if you don't set one, precomputed lists of hashed emails or phone numbers don't match them. Use hashing where you need to count or correlate, and placeholders (default, custom or empty) everywhere else.

What PII redaction doesn't cover

PII redaction in Azure Monitor matches patterns, so plan for these consequences:

  • It doesn't understand meaning. Names, addresses, health details and secrets such as API keys don't follow the five patterns, so they pass through. That's why "Jordan Lee" is still in the example.
  • Patterns can miss, and they can over-match. Unsupported phone formats, IPv6 addresses and identifiers stored in numeric fields aren't replaced. Over-matching happens too: a version string such as 1.2.3.4 is stored as [REDACTED_IPV4], and in our own test run, a 12-digit timestamp inside a test ID came back as [REDACTED_PHONE]. Test with data that looks like yours before you depend on the results.
  • It only changes what's stored. Your agent, the model provider, local log files and other exporters still see the original values.
  • It only applies to new data. Existing records aren't rewritten, and removing the processor doesn't restore values that were already replaced.
  • Some tables aren't covered. For Application Insights data, it works in tables that support workspace transformations, such as AppTraces. The OTelTraces table doesn't support transformations.

Use PII redaction as one control among several. Capture less at the source, as the tracing guidance for AI agent frameworks recommends for content recording in production, and give prompts and responses their own access control with Protected tables, also in public preview at Ignite. Redaction supports your privacy and compliance work, but it doesn't make a workload compliant on its own.

Get started

To start using PII redaction in Azure Monitor:

  1. Apply for the public preview at aka.ms/pii-redaction-preview. Any Azure customer can apply, and the processor works after your subscription is enabled.
  2. Find the DCR for your data path: the workspace transformation DCR for Application Insights data (add to it if your workspace already has one), or the collection DCR for Azure Monitor Agent and Logs Ingestion API data.
  3. Add the scan.SensitiveInfo processor with the types and strategies you need, using DCR API version 2025-05-11.
  4. Send synthetic test records, such as addresses at example.com, through the same path as your real data. Confirm they arrived with values replaced, and keep them as a regression check.

For full setup and rollback steps, see Redact sensitive information in Azure Monitor Logs.

Back to that Friday. With email hashing on AppTraces, the trace still shows the order tool rejected the request, and the email token shows it was the same customer every time. The phone numbers never reach that table, or the alerts and screenshots built from it. The name still does, so keep content capture off when you're not debugging.

We'd like to hear which identifiers and data paths matter most to you. Tell us in the comments.

Updated Nov 12, 2026
Version 1.0
No CommentsBe the first to comment