-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
InfraSecurityarchitectureenhancementNew feature or requestNew feature or requestmicrosoftwhere microsoft team is involved and or they lead the taskwhere microsoft team is involved and or they lead the task
Description
Summary
Current OpenAI usage logging (openai-usage-logging fragment) captures token counts and metadata (model, tenant, subscription) but NOT the actual prompt text or completion text. There is no audit trail of what was asked and what was returned.
Gap
Government AI governance frameworks often require audit trails for model interactions - what prompts were sent, what responses returned, and whether any content safety issues were flagged. Without this, compliance audits have visibility into "how much" but not "what."
Proposed Implementation
- Create a new
audit-loggingpolicy fragment that captures:context.Request.Body(post-PII-redaction, so anonymized)context.Response.Body(completion text)- Content safety verdict (if
llm-content-safetyis implemented) - Tenant, subscription, model, and timestamp metadata
- Log to Application Insights custom events (or a dedicated Log Analytics workspace)
- Make it opt-in per tenant via an
audit_logging_enabledflag in tenant tfvars - Add the flag to
templatefile()variables instacks/apim/locals.tf
Considerations
- Privacy: PII redaction runs before audit logging, so logged prompts would be anonymized for OpenAI requests
- Storage costs: Full prompt logging significantly increases App Insights ingestion costs - consider sampling or a separate workspace
- Retention: Define retention policies aligned with BC Gov records management
- Data residency: Ensure logs stay in Canada East
Prerequisites
- Confirm BC Gov audit requirements for AI model interactions
- Assess App Insights cost impact with estimated request volume
- Determine if a separate Log Analytics workspace is needed for audit data
Severity
MEDIUM - Depends on specific BC Gov audit requirements for AI services.
Context
Identified during APIM multi-tenancy and AI gateway policy gap analysis (Feb 2026).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
InfraSecurityarchitectureenhancementNew feature or requestNew feature or requestmicrosoftwhere microsoft team is involved and or they lead the taskwhere microsoft team is involved and or they lead the task
Type
Projects
Status
Backlog