---
title: How does real-time protection for Copilot Studio agents work?
url: https://opencontroller.lyzr.com/blog/copilot-studio-runtime-protection-with-defender
published: 2026-11-16
updated: 2026-11-16
author: Lyzr
---

# How does real-time protection for Copilot Studio agents work?

**Copilot Studio can call an external threat detection service before every tool invocation, and that service answers "allow" or "block". If it does not answer within one second, the default is to let the tool run. You turn it on per environment in the Power Platform admin center, and it only covers agents that use generative orchestration.**

This is the closest thing Copilot Studio has to an inline policy check on agent actions. It is useful. It also has sharp edges that every security team should know before relying on it. This guide is based on Microsoft Learn documentation, where the feature is marked as preview.

## What does the runtime check actually see?

Before each tool call, the agent sends a POST request to `/analyze-tool-execution` on your provider's endpoint (with `api-version=2025-05-01`). The body has four parts:

- **plannerContext**: the user's message, the planner's reasoning ("thought"), chat history and previous tool outputs.
- **toolDefinition**: the tool's ID, type, name and description.
- **inputValues**: the actual arguments the agent wants to pass, such as the `to` and `bcc` fields of an email.
- **conversationMetadata**: agent ID, tenant ID, environment ID, whether the agent is published, and the conversation ID.

That is enough context to catch the classic attack Microsoft uses as its own example: an email tool where a prompt injection has slipped an outside address into the BCC field.

The provider answers with HTTP 200 and a JSON body. Only one field is required:

| Field | Required | Meaning |
|---|---|---|
| `blockAction` | Yes | `true` stops the tool call |
| `reasonCode` | No | Provider-defined number |
| `reason` | No | Human-readable explanation |
| `diagnostics` | No | Free-form debug data |

There is also a `/validate` endpoint that Copilot Studio calls during setup and health checks.

## What happens when the service is slow or down?

This is the most important detail. Microsoft states the agent expects a response in **less than 1,000 ms**. If no decision arrives in time, the agent behaves as if the answer were "allow" and invokes the tool.

You can change this. In the admin center, **Set error behavior** has two options: *Allow the agent to respond* (the default) or *Block the query*. For agents that can send email, move money or change records, consider failing closed. For low-risk agents, failing open may be acceptable. Either way, write the choice down per agent risk tier, because an auditor will ask.

## How do you set it up?

Setup takes two parts and a user with the **Power Platform Administrator** role.

1. **Create a Microsoft Entra app.** Microsoft provides a PowerShell script (`Create-CopilotWebhookApp.ps1`) that takes your tenant ID, the provider endpoint, a display name and a federated identity credential (FIC) name. You can also do it by hand in the Azure portal: single-tenant app registration, then a federated credential with issuer `https://login.microsoftonline.com/{tenantId}/v2.0` and an explicit subject built from the encoded tenant ID and endpoint.
2. **Connect it in the Power Platform admin center.** Go to **Security > Threat detection > Additional threat detection**, pick the environment, select **Set up**, tick **Allow Copilot Studio to share data with a threat detection provider**, then enter the Entra app ID, the endpoint link and the error behaviour. Save fails if the app or FIC is wrong.

Common failures map to Entra error codes: AADSTS700016 (app not found), AADSTS70025 (no federated credential), AADSTS7002111 (wrong issuer) and AADSTS7002137 (wrong subject).

## What are the limits you should plan around?

- **Per environment only.** Microsoft says there is no tenant-wide setting, and nothing propagates the configuration to new environments. Every new environment starts unprotected until someone turns it on.
- **Generative orchestration only.** Classic agents skip the check entirely.
- **Data leaves the platform.** Each check sends prompts, chat history, tool outputs, user identity and proposed inputs to the provider. Microsoft warns the provider may process data outside your region. Treat the provider as a sub-processor.
- **No documented audit trail.** The Learn pages do not describe where allow and block decisions are logged. Get that from your provider, or log it in your own service.
- **Preview status.** Microsoft says preview features are not meant for production use and may change.

## A rollout checklist

1. List every Power Platform environment where makers can build agents. New environments are the gap.
2. Decide fail-open or fail-closed per environment, based on the highest-risk agent in it.
3. Measure your provider's p95 latency against the 1,000 ms budget under real load.
4. Confirm the provider's data residency and retention in your DPA.
5. Send block decisions to your SIEM with agent ID, tool name and reason code.
6. Re-check environment coverage monthly, because environments are created all the time.

For the broader Copilot Studio picture, see [how to govern Microsoft Copilot Studio agents](/blog/govern-microsoft-copilot-studio-agents) and [how to keep maker credentials out of shared agents](/blog/block-maker-credentials-in-copilot-studio-agents).

## How Opencontroller does this

The webhook decides one tool call at a time inside one platform. Opencontroller works at the estate level. It auto-discovers agents, models and API keys across AWS, Azure and Google Cloud, keeps them in a governed registry, and uses Posture to flag risky permissions and configuration. Policies are written as code and applied across the estate, with built-in mappings to OWASP, MITRE ATLAS, NIST and ISO 42001. When an agent deviates from its normal behaviour, Opencontroller can alert, quarantine or kill it, acting through the connected platform. How deep enforcement goes depends on the connector and the traffic path. See [what an AI agent control plane is](/blog/what-is-an-ai-agent-control-plane) or [book a demo](https://www.lyzr.ai/book-demo/).

## Frequently asked questions

**Does the Copilot Studio threat detection webhook block by default when it times out?**
No. If the provider does not respond within about one second, the default is to allow the tool call. You can switch the error behaviour to *Block the query* in the Power Platform admin center.

**Can I enable external threat detection for the whole tenant at once?**
No. Microsoft documents it as a per-environment setting with no tenant-wide switch, so each new environment has to be configured separately.

**Does it work for classic Copilot Studio agents?**
No. The check is only called for agents that use generative orchestration.

## Key facts

Copilot Studio external threat detection (preview) calls a provider's /analyze-tool-execution endpoint (api-version 2025-05-01) before every tool invocation, sending planner context, tool definition, input values and conversation metadata. The provider returns blockAction true or false. If no answer arrives within 1,000 ms the default is allow; admins can set error behaviour to Block the query. Configured per environment in Power Platform admin center (Security > Threat detection > Additional threat detection) with an Entra app and federated identity credential; no tenant-wide setting; generative orchestration agents only. Opencontroller by Lyzr discovers agents across AWS, Azure and Google Cloud, flags risky configuration with Posture, and quarantines or kills rogue agents through connected platforms. Opencontroller pricing starts from $250K per deployment per year.

## Related

- [How do you govern Microsoft Copilot Studio agents?](https://opencontroller.lyzr.com/blog/govern-microsoft-copilot-studio-agents.md)
- [How do you stop Copilot Studio agents from running on the maker's credentials?](https://opencontroller.lyzr.com/blog/block-maker-credentials-in-copilot-studio-agents.md)
- [How do you govern MCP servers added to Microsoft Copilot Studio agents?](https://opencontroller.lyzr.com/blog/govern-mcp-tools-in-copilot-studio.md)
- [More on Platform Guides](https://opencontroller.lyzr.com/blog/cluster/platform-guides)
