Microsoft Sentinel Article Series: How To Integrate OpenAI GPT3 with SOAR Ms Sentinel

Jeffry Gunawan
MII Cyber Security Consulting Services
4 min readJul 13, 2023

This use case outlines an incident management process in Microsoft Sentinel, triggered by a specific event like a suspicious network connection. Upon trigger, the system appends a comment detailing the attacker’s methods per the Mitre Att&ck framework and generates a task to guide further investigation. This investigation could involve data collection, automated probes, or specific containment or remediation actions. To facilitate the investigation, the system also suggests a Kusto Query Language (KQL) query based on the outcome of a previous task, enabling a search for specific events or log entries to gather more information about the incident and understand the cause and scope of the attack.

Pre-Requisites :

  • Active Azure Subscriptions
  • Active Microsoft Sentinel
  • Logic Apps
  • Right Permissions

Original Templates :

https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Fformat81%2FMicrosoftSentinel-ChatGPT-playbook%2Fmain%2Fazuredeploy.json

Flowchart of GPT SOAR created by Antonio Formato

How To Install :

  1. Create from Template (Just Click Link at above or this )
Use template from Mr Formato

2. Click Review+Create then Edit your Playbook you’ve created before.

Click Edit the logic apps

3.In your first flow blue color with sentinel logo, Click the box then Change Connection with your email connected to azure sentinel (see picture below)

4. In your second flow alias orange color, Click the box then Change Connection, connect your API from OpenAI from link below :

5. Generate your API key, save in another secret place.

6. Connect your API in your Logic Apps with format
(dont forget to add Bearer word before the api-key):

“Bearer api-keyblablabla”
Configure First and Second Flow

7. Fill all parameters. I started from the left side first then right side tree. here the left third flow..

you just need to adjust max token so that prompt message from gpt fully completed. You can adjust by yourself.

Left Tree 4th Flow
Left Tree 4th Flow part 2

8. Then here the configuration of Right Tree flow

Right Tree

9. Save.

Trigger Your SOAR Manually

  1. Go to Incident, Click 1 of the incident then Actions.

2. Run Playbook

Run Trigger Manually

3. Choose Your Right Playbook from your right resources-group. click Run.

Run Playbook

4. Done. Check your Playbook or your Result.

Triggered Playbook

Result :

Click Close the playbook bar. Go to View Full Details. Then Scroll down until you find a comment like below

Comment by GPT

Then view Task generated By GPT :

Task and KQL Generated by GPT.

But you must really know the GPT-3 have so many limitation. soon i will give you tutorial how to integrate the GPT-4.

Troubleshot Permission Unauthorized

Here i guide you if you find unauthorized permissions.

Error Sample Screenshot

You Dont have Access to Resource Group
You Dont have access to trigger playbook
You Dont Have Save Permission to your Logic Apps

Remember : Dont forget to choose the right Resource-Group.

If you cannot trigger because of permission, configure your permission about sentinel and resource-group at here :

Sentinel Settings

Click Playbook permissons then click Configure permissions

Playbook Permissions

Give the permission and done. Run or Save your Playbook.

Here is the references of Sentinel Roles, You can give role from this tutorial.

https://learn.microsoft.com/en-us/azure/sentinel/roles#microsoft-sentinel-roles-permissions-and-allowed-actions

Add Roles :

If you want to adding roles, go to the resources-group then IAM.

Go to Add and Add role assignment

Enter your Roles, dont forget to add member like below

Add roles member

Save.

Thank you for reading!!

References

Thanks to Mr. Antonio Formato

https://medium.com/@antonio.formato/chatgpt-and-microsoft-sentinel-simplify-the-incident-handling-process-7f1c6a1ed925

https://github.com/format81/MicrosoftSentinel-ChatGPT-playbook

https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles

--

--

Jeffry Gunawan
MII Cyber Security Consulting Services

Cyber Security Consultant | CEH(P), CHFI, ECIH, CSA, CSCU, SC200,400,300,900