This article was drafted with AI help and reviewed by the author.
A voice agent for a clinic rarely works alone. When the caller asks for Thursday, the agent calls a tool, and the tool is often an ASP.NET Core API you own. Find a slot. Hold it. Book it. Look up the caller.
Those requests carry names, birth dates and reasons for the visit. Your API needs them for a few milliseconds. Your telemetry may keep them for months.
This post walks through where caller details slip into Application Insights and Log Analytics in a typical .NET setup, and how to stop each one. The sample values are made up. It is engineering guidance, not legal advice.
Covered is not the same as wanted
Microsoft offers a HIPAA business associate agreement through its Product Terms, and it applies to the Azure services listed as in scope. Check the "cloud services in audit scope" list for every service your API touches. Do not assume.
Even when the monitoring service is covered, you probably do not want patient data in it. Many more people can query logs than can open patient records. Developers on call, support staff, a dashboard shared with a vendor. Minimum necessary is a good rule for telemetry too.
Leak one, the route
A tool endpoint shaped like "find patient by phone 5550101" puts the phone number in the request URL. The URL lands in the requests table, in dependency calls from upstream services, and in any gateway logs in front of the API.
The fix is boring. Tool calls send caller details in the request body, and URLs only ever contain opaque ids. Before, the path held the phone number. After, the path is "lookups", the number is in the body, and the response gives back a random lookup id the agent uses from then on.
Leak two, HTTP logging
ASP.NET Core has an HTTP logging middleware. It can log headers and bodies. Microsoft's own page warns that it can capture personal data and tells you to consider redaction.
For tool endpoints, either leave it off or limit it to the method, path and status code. Never turn on body logging to chase a bug in production. If you need bodies for debugging, do it against synthetic data in a test environment.
Leak three, structured log parameters
Structured logging is good practice, and it is also how a birth date ends up as a searchable column. A line like "booking created for patient name at time" turns each value into a property.
.NET has a redaction library for this. You classify sensitive values, register a redactor for each classification, and enable redaction on the logging pipeline. Then a log line still shows that a value existed, without the value itself. Microsoft documents it under data classification and data redaction in .NET.
The habit matters more than the library. Log ids and outcomes. "Booking 7731 created, status held." Not who it was for.
Leak four, exception messages
This one hides well. Somewhere a guard clause throws "No patient found for Sample Person, born 1 January 1980." The exception message becomes part of exception telemetry, with the stack trace, and lives as long as the exceptions table does.
Rule of thumb: exception messages describe what failed, never who it failed for. "No patient matched lookup 9f2c." The lookup id lets an engineer with the right access find the details elsewhere.
Leak five, trace attributes
If you add custom attributes to spans, or your HTTP client instrumentation records full URLs of downstream calls, those end up in the dependencies table. Microsoft's guide to filtering OpenTelemetry in Application Insights lists keeping personal data out as one reason to filter, and shows processors that run before the exporter. Use one to drop or mask attributes you know are risky, and to drop query strings on calls to scheduling or records systems.
Treat this as the safety net, not the plan. A filter only catches what you thought of.
Retention, for whatever gets through
Log Analytics keeps most tables for 30 days by default, some for 90. You can extend analytics retention up to two years, and total retention much longer. When you shorten total retention, Azure waits 30 days before removing data, so a change made today does not clean anything up straight away.
Pick retention on purpose for the tables your API writes to. Short for traces and requests. Whatever your compliance team decides for anything audit-related.
Audit logs are a different thing
HIPAA's audit controls are about recording who accessed health data and what changed. That is a deliberate store with its own access rules and its own retention. It is not the same as diagnostic telemetry, and mixing them means either your audit trail gets pruned or your diagnostics keep patient data too long.
Write audit events to their own destination. Give a small group access. Keep the diagnostic side free of patient values.
A canary test
You cannot prove a negative by reading code. You can come close with a canary.
- Create a fake patient with a distinctive name, for example Zz Canary Testpatient, and a birth date nobody has.
- Run a full voice agent flow against your test environment with that patient. Find, book, then cancel.
- Force one failure on purpose, such as a lookup with a wrong birth date.
- Wait for ingestion, then search every table in the workspace for the canary name and the birth date.
- Any hit is a leak. Fix it, then run the test again.
Run the same test after each release that touches tool endpoints or logging.
Takeaways
- Check each Azure service against Microsoft's in-scope list, then keep patient data out of telemetry anyway.
- Caller details go in request bodies. URLs carry opaque ids.
- Keep HTTP body logging off for tool endpoints.
- Redact classified values in logs, and keep names out of exception messages.
- Filter span attributes before export as a safety net.
- Audit logs and diagnostic telemetry are separate stores.
- Prove it with a canary.
The HIPAA side of the whole call path, from agreements with each vendor to storage settings, is covered in this voice agent deployment checklist.
References
- Microsoft Learn: HIPAA, Azure compliance offering
- Microsoft Learn: Cloud services in audit scope
- Microsoft Learn: HTTP logging in ASP.NET Core
- Microsoft Learn: Data redaction in .NET
- Microsoft Learn: Filter OpenTelemetry in Application Insights
- Microsoft Learn: Manage data retention in a Log Analytics workspace
- eCFR: 45 CFR 164.312 technical safeguards