Azure Copilot Studio Integration
Monitor Microsoft Copilot Studio bots for behavioral drift, prompt injection, and data leakage — without any code changes. Trappr operates from the infrastructure layer via the Bot Framework Direct Line API and optionally enforces takedown through the Power Platform Admin API.
How it works
Trappr establishes a behavioral baseline for each Copilot Studio bot by sending a configurable probe query via the Direct Line API and recording the response. On each scheduled scan:
- Trappr opens a new Direct Line conversation with the bot.
- Sends the configured probe query (e.g., “Hello, what is your primary role?”).
- Checks the response for expected keywords. Missing keywords = behavioral drift.
- Runs the response through Trappr's DLP engine to detect PII or sensitive data leakage.
- Checks for canary token exposure if you've seeded canaries into SharePoint documents the bot reads.
- If drift or exposure is detected, fires an alert (Slack, email, webhook) and optionally unpublishes the bot.
Prerequisites
- A Copilot Studio bot published with the Direct Line channel enabled.
- The bot's Direct Line secret (from Copilot Studio portal → Channels → Direct Line).
- A Trappr account with a workspace connected to the bot's owning app.
- Optional (for enforcement): A Microsoft Entra service principal with Power Platform API access.
Step 1: Enable Direct Line
- Open your bot in Copilot Studio (make.powerapps.com → Copilot Studio).
- Go to Settings → Channels → Direct Line.
- Click Add channel if Direct Line is not yet enabled.
- Copy one of the Secret keys — you will enter this in Trappr.
Step 2: Connect to Trappr
- In the Trappr dashboard, open Workspace → Connect Workspace.
- Select Azure Copilot Studio as the platform.
- Enter:
- Connection name — e.g., “HR Bot (Prod)”
- Direct Line Secret — from Copilot Studio
- Probe Query — the message Trappr sends on each scan (default: Hello, what is your primary role?)
- Expected Keywords — comma-separated terms the bot response should include (e.g., HR, policy, benefits)
- Click Connect & Discover. Trappr will send the probe and record the baseline.
Step 3: Verify baseline
After connecting, Trappr displays the behavioral fingerprint — the probe response with matched keywords highlighted. If the baseline looks correct, click Confirm Baseline. Future scans compare against this baseline.
Step 4: Configure alerts
Go to Settings → Alerts and configure at least one alert channel (Slack, email, or webhook). Trappr will fire an alert whenever:
- Keyword coverage drops below the similarity threshold (behavioral drift).
- A canary token is detected in the bot's response.
- A DLP pattern (PII, financial data, custom regex) is found in the response.
Optional: Azure APIM Gateway Integration
For Azure OpenAI deployments behind Azure API Management (APIM), you can route all LLM calls through the Trappr gateway for real-time DLP, canary detection, and enforcement:
- In Azure APIM, create three Named values:
TrapprGatewayKey(secret) — your Trappr API keyTrapprAgentId— your Trappr agent IDAzureOpenAIBackend— your Azure OpenAI endpoint
- Download the policy template and apply it to your APIM API or Product:
<on-error> block to switch to fail-closed mode.Optional: Azure Monitor Event Hub → OTLP Bridge
To feed Azure OpenAI diagnostic logs (full prompt + response) into Trappr for anomaly detection and audit trail, deploy the Event Hub bridge as an Azure Logic App:
- In Azure Monitor, configure Diagnostic Settings on your Azure OpenAI resource to stream logs to an Event Hub.
- Create a consumer group named
trappron the Event Hub. - Download and deploy the ARM template:
# Deploy via Azure CLI
az deployment group create \
--resource-group YOUR-RG \
--template-file eventhub-otlp-bridge-arm.json \
--parameters \
eventHubNamespaceName=YOUR-NAMESPACE \
eventHubConnectionString="Endpoint=sb://..." \
trapprApiKey=cht_gw_YOUR_KEY \
trapprAgentId=cht_agent_XXXXOptional: Power Platform Enforcement
When Enforcement Mode is set to ENFORCE and Trappr detects a critical violation, it can automatically unpublish the bot via the Power Platform Admin API. This requires a Microsoft Entra service principal with Power Platform API permissions.
Required service principal permissions
PowerApps Service→User(application permission)- Power Platform Environment Admin role on the target environment.
Configuration
In the Trappr workspace connect form, expand Power Platform Enforcement (optional)and enter:
- Environment ID — from Power Platform Admin Center → Environments → Details.
- Bot Application ID — the bot's app ID in Power Platform.
- Tenant ID, Client ID, Client Secret — from the Entra service principal.
Optional: SharePoint Canary Seeding
If your Copilot Studio bot reads documents from SharePoint, you can seed canary tokens into those documents. Any bot that returns a canary token in its response triggers an immediate incident.
Use the Trappr API to seed a canary into a SharePoint document:
curl -X POST https://trappr.net/api/v1/azure/sharepoint-canary \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"siteUrl": "https://myorg.sharepoint.com/sites/HR",
"documentPath": "/Shared Documents/AI Policy Docs/context.txt",
"graphClientId": "YOUR_ENTRA_APP_CLIENT_ID",
"graphClientSecret": "YOUR_ENTRA_APP_CLIENT_SECRET",
"graphTenantId": "YOUR_TENANT_ID",
"agentId": "cht_agent_XXXX"
}'The API injects a canary token into the document. If any Copilot bot reads the document and echoes the canary, Trappr detects it and creates an incident automatically.
Sites.ReadWrite.All orFiles.ReadWrite.All application permission (admin consent required).What Trappr detects
| Threat | Detection method | Alert |
|---|---|---|
| Behavioral drift (prompt injection, persona hijack) | Scheduled Direct Line probe — keyword mismatch | HIGH / CRITICAL |
| Data exfiltration via canary token | Canary token in bot response | CRITICAL |
| PII leakage (email, SSN, credit card) | DLP engine on probe response | HIGH |
| Full LLM audit trail anomalies | Event Hub → OTLP bridge → Trappr observe | MEDIUM |
Limitations
- Trappr cannot access the bot's system prompt or topic configuration — monitoring is behavioral only.
- Direct Line probes are billed as regular conversations in Copilot Studio message capacity.
- Enforcement (bot unpublish) requires Power Platform service principal credentials — not available for all enterprise tenants.
- The Event Hub bridge requires Azure Monitor Diagnostic Settings, available only on paid Azure OpenAI tiers.
Next steps
- Enforcement Mode — configure MONITOR vs ENFORCE
- Data Loss Prevention — set up custom DLP patterns
- Canary Tokens — understanding how canary detection works
- Agent Monitor — view scan history and drift alerts