How suchandanreddy/ms-sentinel-customgraph-securitycopilot works
1. This repository is not an application runtime; it is an implementation package for a security investigation workflow. The core artifact is a Microsoft Sentinel Custom Graph solution that lets analysts trace compromised identities to infrastructure access and related security alerts.
2. The architecture has four clear layers. At the bottom is the Sentinel Data Lake, which holds the source telemetry tables. Above that is a PySpark notebook/job that transforms telemetry into a graph. The graph is stored as a Custom Graph instance. At the top is a Security Copilot agent that queries the graph during investigations.
3. The data boundary starts with four Sentinel-backed tables: SigninLogs_ID_KQL_CL, CommonSecurity_ID_KQL_CL, DeviceProcessEvents_KQL_CL, and SecurityAlerts_KQL_CL. These represent identity sign-ins, infrastructure access telemetry, endpoint process activity, and detections/alerts. They are the only documented data inputs for the graph build.
4. The graph-building boundary is the notebook samples/graph-notebooks/IdentityDrift_AccessGraph.ipynb. It uses PySpark and a GraphSpecBuilder-style API to transform the Sentinel tables into a custom graph schema. A companion job YAML schedules this notebook as a daily graph refresh, making the graph a periodically rebuilt derived dataset rather than a live streaming system.
5. The Custom Graph layer is named IdentityDrift_AccessGraph and is the main queryable security model. The README documents 4 node types and 6 edge types, including identities, workloads, devices, and alerts, with relationships such as access, device usage, process execution, and alert triggering/detection. This graph is the central analytical boundary for investigations.
6. The Security Copilot layer is driven by samples/agent-manifests/IdentityDrift-SecurityCopilot-Agent.yaml. That manifest defines the agent behavior and the predefined graph queries it can execute. It acts as the interactive interface for analysts and does not build data itself; it consumes the graph via REST/GQL queries.
7. Authentication is delegated to the analyst’s Azure AD identity. The agent uses AAD delegated access with the https://purview.azure.net/.default scope, and data access inherits the analyst’s Sentinel workspace RBAC. This means the security boundary is user-contextual, not service-account driven.
8. A key architectural rule is fail-closed query execution. The agent is configured to extract the target identity from the current user message, run a fresh query on every turn, and avoid reusing prior results. The request pattern includes unique request IDs to reduce caching and enforce fresh retrieval each time.
9. The investigation data flow is: analyst prompt → agent extracts identity → agent substitutes parameters into a predefined graph query → graph query runs against the Custom Graph REST API → results are parsed into identity-to-workload-to-alert chains → agent returns structured findings and recommendations. This makes the graph the only analytical source of truth during the conversation.
10. The repository’s main value is in its documentation and deployable samples. The docs/ directory explains setup, architecture, graph design, and agent deployment; samples/ contains the runnable notebook, the scheduled job definition, and the Copilot agent manifest. There is no separate backend service, database schema, or UI code in this repo beyond these operational artifacts.
Main entry points: IdentityDrift_AccessGraph.ipynb Access graph · 02-architecture.md Architecture · IdentityDrift-SecurityCopilot-Agent.yaml Copilot agent · README.md README
Components 18
Documentation
Architecture and setup guidance
- README · Entry point describing the solution, architecture, and samples
README.md - Start Here · Environment and initial configuration guidance
docs/01-getting-started.md - Architecture · Explains the layered system and data flow
docs/02-architecture.md - Build Graph · How the custom graph is constructed from Sentinel telemetry
docs/03-Build-Custom-Graph.md - Build Agent · How to deploy and configure the Security Copilot agent
docs/04-Build-Security-Copilot-Agent.md
Sentinel Data Lake
Source telemetry tables used to build the graph
- Sign-ins · Identity sign-in telemetry source
- Access telemetry · Infrastructure access and common security events
- Process events · Endpoint process activity telemetry source
- Alerts · Detections and security alert telemetry source
Graph Build
Notebook and scheduled refresh that materialize the custom graph
- Access graph · Transforms Sentinel telemetry into the custom graph schema
samples/graph-notebooks/IdentityDrift_AccessGraph.ipynb - Daily refresh · Runs the notebook on a recurring basis to rebuild the graph
- Samples · Runnable artifacts for graph build and agent deployment
Custom Graph
Queryable security model for investigations
- IdentityDrift_AccessGraph · Queryable graph used as the source of truth during investigations
- Graph model · Defines identities, workloads, devices, alerts, and their relationships
Security Copilot
Agent-driven investigation layer
- Copilot agent · Defines the Security Copilot agent behavior and graph queries
samples/agent-manifests/IdentityDrift-SecurityCopilot-Agent.yaml - AAD delegated · Analyst-context authentication and workspace RBAC enforcement
- Graph API · REST/GQL access path used by the agent to query the custom graph
- Investigation flow · Extracts identity, runs fresh queries, and returns findings
Connections 21
- README → Architecture: documents · README points to the architecture and sample workflow
- README → Samples: references · README introduces the runnable samples
- Start Here → Access graph: prepares · Setup steps enable the graph-building notebook
- Architecture → Build Graph: explains · Architecture docs lead into graph construction details
- Architecture → Build Agent: explains · Architecture docs lead into agent deployment details
- Sign-ins → Access graph: input · Identity sign-in telemetry feeds the graph build
- Access telemetry → Access graph: input · Infrastructure access telemetry feeds the graph build
- Process events → Access graph: input · Process activity telemetry feeds the graph build
- Alerts → Access graph: input · Alert telemetry feeds the graph build
- Access graph → Graph model: builds · Notebook transforms telemetry into graph nodes and edges
- Daily refresh → Access graph: runs · Scheduled job executes the notebook daily
- Access graph → IdentityDrift_AccessGraph: materializes · Notebook refreshes the custom graph instance
- Graph model → IdentityDrift_AccessGraph: defines · Schema shapes the stored graph model
- Copilot agent → AAD delegated: uses · Agent operates with delegated analyst identity
- AAD delegated → Graph API: authorizes · Workspace RBAC and delegated token scope gate graph access
- Copilot agent → Investigation flow: drives · Manifest defines the investigation behavior
- Investigation flow → Graph API: queries · Agent submits predefined graph queries on each turn
- Graph API → IdentityDrift_AccessGraph: reads · Graph API retrieves investigative results from the custom graph
- Investigation flow → IdentityDrift_AccessGraph: analyzes · Findings are derived from the graph as the source of truth
- Build Agent → Copilot agent: deploys · Documentation points to the agent manifest sample
- Build Graph → Access graph: implements · Documentation points to the notebook sample