Skip to content
LessIT

Security Copilot

Generate Playbooks Using AI in Microsoft Sentinel

Co-author Python SOAR playbooks with the Cline coding agent in the embedded VS Code of the Defender portal, describe the automation in plain language and generate validated code.

Intermediate 90 min 8 steps

Where it fits: lab 4 of 6

Investigate and automate with Security Copilot. Enable Security Copilot, build promptbooks, hunt with the agent, generate playbooks with AI and deploy it across the Microsoft security stack.

  1. Enable Security Copilot & First Investigation 60 min
  2. Build Custom Promptbooks for Incident Triage 90 min
  3. Copilot in Defender: Threat Hunting Agent Best Practices 2.5 h
  4. Generate Playbooks Using AI in Microsoft Sentinel 90 min
  5. Embedded Experiences & Zero Trust Deployment 120 min
  6. Security Copilot: Provisioning, RBAC and Vulnerability Management Agent 3 h

What this lab covers

Security orchestration, automation, and response (SOAR) usually means building automation flows by hand. The Microsoft Sentinel playbook generator changes that. You describe what you want in natural language, and Cline, an AI coding agent hosted in a Visual Studio Code environment embedded in the Defender portal, co-authors a validated, Python based playbook for you. The generated playbook takes alert data as input and dynamically builds the required application programming interface (API) calls, as long as you configure an integration profile for each target service. In this lab you will confirm the environment prerequisites, register a Microsoft Entra ID application, create a Microsoft Graph integration profile, generate a playbook through a conversation in Plan mode and Act mode, test it against a real alert, enable it, and wire it to an enhanced alert trigger so it runs automatically.

The enterprise scenario

A healthcare provider runs a lean security operations center (SOC) with three analysts who face a steady stream of phishing alerts. Writing traditional Logic Apps playbooks takes developer time the team does not have, so most enrichment and containment stays manual. Every phishing alert requires an analyst to look up the sender, confirm the account exists in the directory, decide whether to disable it, and message the security channel. With the playbook generator the team describes this exact flow in a sentence or two and receives working Python automation, complete with documentation and a visual flow diagram, in minutes. Analysts who are not developers can build and adjust automation themselves, so the SOC automates more of its repetitive response work without waiting on an engineering backlog.

What you will learn

  • Confirm the Security Copilot, workspace, and Microsoft Defender role requirements for the playbook generator
  • Configure a dedicated Security Copilot workspace with the required privacy settings
  • Register a Microsoft Entra ID application and create a client secret
  • Create a Microsoft Graph integration profile using OAuth2 client credentials
  • Create a generated playbook and describe requirements to Cline in Plan mode
  • Review the generated plan and flow diagram, then switch to Act mode to produce Python code
  • Test the playbook against a real alert, validate it, save it, and enable it
  • Create an enhanced alert trigger and monitor playbook execution

Before you start

  • Security Copilot enabled - Your tenant must be Security Copilot enabled with Security Compute Units (SCUs) available. You are not billed for SCUs for this feature, but their availability is a technical requirement.
  • Microsoft Sentinel workspace onboarded to Defender - Your tenant must have a Microsoft Sentinel workspace onboarded to the Microsoft Defender portal.
  • Data sharing preferences - In Security Copilot, enable the first slider, "Allow Microsoft to capture data from Security Copilot to validate product performance using human review", under Customer Data Sharing preferences.
  • Defender RBAC to use the generator - Authorization and settings: Detection tuning (manage) , and Security operations: Security Copilot (read) .
  • Defender RBAC to author automation rules - The Microsoft Sentinel Contributor role on the relevant workspaces or resource groups in Defender.
  • Permission to register an application - Rights in Microsoft Entra ID to create an app registration and a client secret, or an administrator who can do it for you.

The 8 steps

  1. Configure a Dedicated Security Copilot Workspace
  2. Register a Microsoft Entra ID Application
  3. Create the Microsoft Graph Integration Profile
  4. Add Any Other Required Integration Profiles
  5. Create a Generated Playbook and Work in Plan Mode
  6. Review the Plan and Generate Code in Act Mode
  7. Validate, Save, and Enable the Playbook
  8. Create an Enhanced Alert Trigger and Monitor Execution

Related labs