Skip to content
Rush Commerce
Software & Dev3 min read

Defender now blocks prompt injection in Claude Code and Copilot

Microsoft Defender runtime protection for local AI agents inspects Claude Code and Copilot CLI for prompt injection. Preview, Windows, Plan 2 or E5.

Microsoft Defender can now watch your developers' AI coding agents and stop a prompt injection before the agent acts on it. Defender for Endpoint's runtime protection for local AI agents hooks into Claude Code, GitHub Copilot CLI and their VS Code extensions on Windows. Microsoft pushed it at Ignite this week. The setup docs still call it a preview, and it only runs on the bigger licenses.

What actually happened

From Microsoft's support matrix and configuration guide:

  • Discovery is generally available on Windows and macOS. Defender finds which local agents are on each device: Claude Code, Codex CLI, Copilot CLI, Claude Desktop, ChatGPT Desktop and more.
  • Runtime protection is preview, Windows only. It inspects agent activity through each tool's own hook points for Claude Code, Copilot CLI, the Copilot app, Claude Desktop in Code mode, and the Copilot and Claude Code extensions for VS Code.
  • A second method reads network traffic between the agent and the model for OpenClaw, Ollama Desktop and ChatGPT Desktop. It can't see agents that use certificate pinning or HTTP/3.
  • Codex is found but not protected. It's in the discovery list but missing from the runtime tables.
  • Both methods ship off. You turn them on with Set-MpPreference -AiAgentProtection and -AiAgentNetworkInspection, or with an Intune profile. Audit mode logs, Block mode stops the action.
  • License gate: Defender for Endpoint Plan 2, Microsoft 365 E5, Agent 365 or Microsoft 365 E7. Defender for Business, the version bundled with Microsoft 365 Business Premium, isn't on that list.
  • Known issue: in Block mode, "Claude Code might continue processing a tool response" after Defender reports a block. That's Microsoft's own caveat.

The June preview post shows the main use case: blocking malicious instructions that come back inside a tool result.

Why it matters for your business

Prompt injection is the attack that matters for coding agents. A README, an issue comment or a scraped web page tells the agent to read .env and post it somewhere. The agent has your shell and your keys, so it does what it's told.

Endpoint-level inspection is a real layer. But look at the fine print. It's preview, Windows only, off by default, and a known bug can let Claude Code keep going after a block. Most 10-to-50-person shops run Business Premium, which doesn't qualify.

So treat Defender as one control, not the whole plan. Run it in Audit mode first if you have the license. Either way, scope agent permissions in the tool itself, keep secrets out of the working directory, and don't give agents long-lived cloud credentials.

Key takeaways

  • Defender discovers local AI agents (GA) and blocks prompt injection in some of them (preview, Windows only)
  • Covered: Claude Code, Copilot CLI, Copilot app, Claude Desktop Code mode, two VS Code extensions
  • Codex is discovered but not protected yet
  • Needs Plan 2, M365 E5, Agent 365 or E7; Defender for Business isn't listed
  • Microsoft says Claude Code may keep processing after a reported block, so don't rely on it alone

Your developers already run AI agents with shell access. We set up coding-agent workflows with scoped permissions, secrets kept out of reach and short-lived credentials, whatever your Microsoft license tier. See what we build or ask us to review your agent setup.

Sources: Microsoft Learn: AI agent support matrix, Microsoft Learn: configure AI agent runtime protection, Microsoft Tech Community.

  • #microsoft-defender
  • #prompt-injection
  • #claude-code
  • #github-copilot
  • #ai-agent-security
TR

Tommy Rush — Founder, Rush Commerce

Operator turned builder. 15+ years running operations — now shipping the systems businesses run on. More

Get The Rush Report weekly — one email, zero fluff.