Home

/

Keep PII Out of Your LLM

/

The Three-Way Choice

The Three-Way Choice

Chapter 6
Part II
3
min read

The options

Self-host Presidio as a container on your own network and call it over HTTP. Call Azure AI Language PII detection, which has a first-class C# SDK and runs in Microsoft's cloud. Or write nothing but native C# rules and accept the ceiling from Chapter 5.

Presidio sidecarAzure AI LanguageNative C# rules
.NET accessREST via HttpClientOfficial SDKIn-process
Where the text goesYour networkMicrosoft's cloudNowhere
Entity coverageBroad, extensibleBroad, fixedChecksummed identifiers only
Latency~15 ms plus a local hopNetwork round trip~0.1 ms
Cross-domain F1~0.48Not independently benchmarked here~0.17
You operateA containerA subscriptionNothing
Reversible pipelineBuilt inRedaction policiesBuild it yourself

What Presidio is, and who owns it now

Presidio detects and de-identifies personal data in text, images and structured data. It has four components:

  • Analyzer finds entities, using spaCy or HuggingFace NER plus regex recognisers, checksum validation, and contextual scoring.
  • Anonymizer applies an operator to each finding: replace, redact, mask, hash, encrypt.
  • Image Redactor does the same over OCR output.
  • Structured handles tabular and semi-structured data.

One fact that most writing on this subject has not caught up with: Presidio is no longer a Microsoft project. The documentation states it is transitioning to a community-owned project, maintained by the Data Privacy Stack organisation. The old microsoft.github.io/presidio address redirects twice before landing on presidio.dataprivacystack.org. You will still find articles published this year calling it "Microsoft Presidio" and linking to a URL that no longer serves content.

This matters beyond pedantry. Your security review will ask who maintains a dependency that sees 100% of your personal data. The honest answer changed. It is not a reason to avoid Presidio, which remains actively developed, with recent releases adding country-specific recognisers and an optional country filter on the predefined set. It is a reason to treat provenance as a standing question rather than a box you ticked at adoption, which is a theme Chapter 14 returns to.

There is no official .NET SDK

Presidio ships Python packages, Docker images, Kubernetes manifests, and REST endpoints. For any language that is not Python, REST is the route.

There is one unofficial C# client, and it deserves a paragraph rather than a chapter. Presidio.SDK by StefH is a RestEase-based client on NuGet. Version 0.0.2, published June 2025, roughly 5.6K total downloads, fourteen commits, targeting .NET 6.0 and .NET Standard 2.1. The analyzer is demonstrated; anonymizer coverage is not evidenced. A companion Presidio.SDK.Extensions package adds a handful of locale-specific pattern recognisers, at around 970 downloads.

Know it exists. Do not build on it. A component in this position, handling every piece of sensitive text in your application, should not depend on a pre-1.0 package with one maintainer and a year since its last release. The REST API is four endpoints and HttpClient is in the framework.

the-leak-you-cant-see
blast-radius
what-counts-as-pii
the-five-doors
the-accuracy-reckoning
the-hybrid-that-does-not-work
deterministic-detection
npi-in-c
the-three-way-choice
calling-the-analyzer-from-c
measuring-your-own-demo-gap
choosing-the-operating-point
the-ladder-of-safeguards
pseudonymisation
the-round-trip
restoring-safely
when-masking-breaks-the-task
plausibility-hazard
the-architecture-that-holds
the-reference-architecture
dont-send-it-at-all
structure-beats-prose
the-gateway
failure-is-a-policy-decision
the-sidecar-you-can-trust
egress-deny-it-at-the-network
rag-and-agents
de-identify-before-you-embed
dual-model-separation
the-boring-controls
evidence-and-the-first-thirty-days
week-two-the-chokepoint-and-the-fast-layer
entity-catalogue-and-c-validators
mbi-positional-rules
tooling-at-a-glance
azure-ai-language-pii-in-detail
container-trust-checklist
sources
azure-ai-language
provider-retention

Download the full PDF for free?

Free download — no account required

Get the PDF
Get the PDF
Related Chapters
Free Download
Get the full PDF
All pages, including all code examples, diagrams, and the appendix reference card.
No spam. Unsubscribe at any time.
Your email won't be shared.
Oops! There's a problem with your request. We're working on fixing it. Please try again later.