Docs/Platform Integrations/Azure Copilot Studio

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.


No code access required. Copilot Studio bots run inside Microsoft's managed infrastructure. Trappr monitors them from the outside via the Bot Framework Direct Line API — the same channel used by Microsoft Teams and the Copilot Studio test pane.

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:

  1. Trappr opens a new Direct Line conversation with the bot.
  2. Sends the configured probe query (e.g., “Hello, what is your primary role?”).
  3. Checks the response for expected keywords. Missing keywords = behavioral drift.
  4. Runs the response through Trappr's DLP engine to detect PII or sensitive data leakage.
  5. Checks for canary token exposure if you've seeded canaries into SharePoint documents the bot reads.
  6. 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

  1. Open your bot in Copilot Studio (make.powerapps.com → Copilot Studio).
  2. Go to Settings → Channels → Direct Line.
  3. Click Add channel if Direct Line is not yet enabled.
  4. Copy one of the Secret keys — you will enter this in Trappr.
Keep the Direct Line secret private. Anyone with the secret can send messages to your bot. Trappr stores it encrypted at rest using AES-256-GCM.

Step 2: Connect to Trappr

  1. In the Trappr dashboard, open Workspace → Connect Workspace.
  2. Select Azure Copilot Studio as the platform.
  3. 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)
  4. 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:

  1. In Azure APIM, create three Named values:
    • TrapprGatewayKey (secret) — your Trappr API key
    • TrapprAgentId — your Trappr agent ID
    • AzureOpenAIBackend — your Azure OpenAI endpoint
  2. Download the policy template and apply it to your APIM API or Product:
Download APIM Policy XML
The policy fails-open by default — if Trappr is temporarily unreachable, requests route directly to Azure OpenAI so your application stays available. Remove the <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:

  1. In Azure Monitor, configure Diagnostic Settings on your Azure OpenAI resource to stream logs to an Event Hub.
  2. Create a consumer group named trappr on the Event Hub.
  3. Download and deploy the ARM template:
Download Event Hub ARM Template
bash
# 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_XXXX

Optional: 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.
Enforcement takedown immediately unpublishes the bot from all channels. All conversations will stop until the bot is manually republished from Copilot Studio after a security review.

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:

bash
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.

The Graph API app registration needs Sites.ReadWrite.All orFiles.ReadWrite.All application permission (admin consent required).

What Trappr detects

ThreatDetection methodAlert
Behavioral drift (prompt injection, persona hijack)Scheduled Direct Line probe — keyword mismatchHIGH / CRITICAL
Data exfiltration via canary tokenCanary token in bot responseCRITICAL
PII leakage (email, SSN, credit card)DLP engine on probe responseHIGH
Full LLM audit trail anomaliesEvent Hub → OTLP bridge → Trappr observeMEDIUM

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