Deploy via Microsoft Defender Endpoint
Overview
Microsoft Defender for Endpoint provides centralized visibility and remote management for enterprise devices. Microsoft Defender Live Response allows you to run scripts remotely on managed devices.
You can use Microsoft Defender Live Response to deploy the Akto AI Endpoint Shield hook on developer machines. Hook installation enables Akto to monitor agent interactions from tools such as Cursor, Claude, or Gemini.
Prerequisites
Microsoft Defender integration requires the following environment configuration.
Administrator access to the Microsoft Defender portal
Microsoft Defender for Endpoint Plan 2 license (Live Response is a Plan 2-only capability)
Devices onboarded to Microsoft Defender for Endpoint
Supported operating systems: macOS, Windows, Linux

Devices must be onboarded using one of the supported onboarding methods:
Microsoft Intune onboarding
Local onboarding script or installation package
Verify device enrolment before running queries or deploying hooks.
Open the Microsoft Defender portal.
Navigate to Assets → Devices.
Confirm that device status shows Active.
Active device status confirms that Microsoft Defender receives endpoint telemetry.
Required Microsoft Entra Application Permissions
Akto authenticates to Microsoft Defender using the OAuth 2.0 client credentials flow against an app registration in your Microsoft Entra tenant. Grant the app registration the following Microsoft Threat Protection / WindowsDefenderATP API permissions (all Application type, not Delegated), then grant admin consent in the Entra portal.
AdvancedQuery.Read.All
Application
Run KQL Advanced Hunting queries (POST /api/advancedqueries/run) — used to discover installed AI software (DeviceTvmSoftwareInventory) and AI CLI process activity (DeviceProcessEvents).
Machine.ReadWrite.All
Application
List onboarded devices (GET /api/machines), read live-response action status (GET /api/machineactions/{id}), and obtain the result download link (GET /api/machineactions/{id}/GetLiveResponseResultDownloadLink). Microsoft requires Machine.ReadWrite.All (not just Machine.Read.All) for the download-link endpoint.
Machine.LiveResponse
Application
Initiate a Live Response session on a device (POST /api/machines/{id}/runliveresponse) — used to push and execute Akto's MCP/skill discovery scripts.
Library.Manage
Application
Upload discovery scripts to the Live Response file library (POST /api/libraryfiles) before they can be invoked on devices.
Additional Defender configuration (separate from API permissions)
API permissions alone are not sufficient for Live Response. Confirm the following on the Defender side:
Live Response feature enabled — In the Defender portal:
Settings → Endpoints → Advanced features → Live Responsemust be On. For Linux/macOS targets, also enableLive Response for serversandLive Response unsigned script executionif your scripts are unsigned.Device group automated remediation level — Each device group used by Akto must have an automated remediation level of at least Standard. Live Response API calls return HTTP 400 (
Forbidden — needs minimum remediation level) for devices in groups configured as No remediation.Defender RBAC scope — If your tenant uses Defender role-based access (rather than the default Use basic permissions model), the app registration's service principal must be assigned a custom Defender role that grants both View data and Active remediation actions, scoped to the device groups Akto should reach.
Common 403 errors and what they mean
Missing application roles. API required roles: Machine.Read.All, Machine.ReadWrite.All
Machine.ReadWrite.All not consented on the app registration.
Missing application roles. API required roles: AdvancedQuery.Read.All
AdvancedQuery.Read.All not consented on the app registration.
Forbidden — needs minimum remediation level
Device group has automated remediation set to No remediation — raise it to Standard or higher.
ActiveRequestAlreadyExists (HTTP 400, not 403)
A prior Live Response action on the same device hasn't finished. Akto retries automatically after cancelling the stale action.
Steps to Deploy
The deployment workflow consists of two stages:
Optional visibility queries to identify AI agents and MCP usage across devices.
Installation of the Akto AI Endpoint Shield hook on developer machines.
(Optional) Identify AI Agent Software Installed on Devices
Software inventory queries help you identify which AI development tools exist across enterprise devices.
Open the Microsoft Defender portal.
Navigate to Investigation & response → Hunting → Advanced hunting.

Paste the following query into the query editor.
Replace
<your-device-name>with a hostname from the Devices inventory.Click Run query.
Query results show devices where AI tools such as Cursor, Windsurf, Claude, VS Code, or Codex are installed.
Remove the DeviceName filter to scan the entire device fleet.
(Optional) Identify AI CLI Activity on Devices
Process telemetry queries help you determine which devices actively run AI CLI agents.
Open Advanced hunting in the Microsoft Defender portal.
Paste the following query into the query editor.
Replace
<your-device-name>with the target device hostname.Click Run query.
Query results show which CLI tools run on enterprise devices, including Claude CLI, GitHub Copilot CLI, Gemini CLI, Codex CLI, and Cursor CLI.
(Optional) Detect MCP Configuration File Usage
MCP configuration files often define agent integrations and tool execution paths. Process telemetry queries help you detect devices referencing MCP configuration files.
Open Advanced hunting in the Microsoft Defender portal.
Paste the following query into the editor.
Replace
<your-device-name>with the device hostname.Click Run query.
Query results show devices referencing MCP configuration files such as:
mcp.jsonmcp_config.jsonclaude_desktop_config.json
You can modify the query to add or remove file names depending on the MCP configurations used in your environment.
Request the AI Endpoint Shield Hook Script from Akto
AI Endpoint Shield deployment requires a hook installation script provided by Akto.
Contact the Akto support team at support@akto.io to obtain the required hook script.
Upload the Hook Script to the Microsoft Defender Live Response Library
Microsoft Defender Live Response allows you to run scripts remotely on enterprise devices.
Open the Microsoft Defender portal.
Navigate to Settings.
Select Endpoints → General → Live response library.
Click Upload file.

Upload the hook script received from the Akto support team.
Example script files include:
install_cursor_hooks.shinstall_claude_hooks.sh
Add a description such as Akto – Install AI Endpoint Shield hooks.
Click Save.
The script must exist in the Live Response library before execution. Upload the script again whenever the script version changes.
Run the Hook Script on a Device Using Live Response
Microsoft Defender Live Response allows script execution on individual devices.
Open the Microsoft Defender portal.
Navigate to Assets → Devices.
Select the target device.
Open the device details page.
Click Initiate live response session.
Wait until the Live Response session connects. Session initialization may take up to two minutes.
After the Live Response console opens, run the hook installation command.
Here we have taken the cursor hook script example:
The script name must match the file uploaded to the Live Response library.
The console displays execution output as the script runs.

Successful execution ends with:
Devices without the required IDE installed exit safely with the following output:
Operational Notes
Microsoft Defender Live Response requires Microsoft Defender for Endpoint Plan 2.
Microsoft Defender Advanced Hunting queries support a maximum time range of 30 days.
Queries scope to a single device by default using
DeviceName contains.Removing the device filter runs queries across the entire device fleet and may return larger result sets.
Get Support for your Akto setup
There are multiple ways to request support from Akto. We are 24X7 available on the following:
In-app
intercomsupport. Message us with your query on intercom in Akto dashboard and someone will reply.Join our discord channel for community support.
Contact
support@akto.iofor email support.
Last updated