How to execute KQL queries in Sentinel Notebooks?

%3CLINGO-SUB%20id%3D%22lingo-sub-2109999%22%20slang%3D%22en-US%22%3EHow%20to%20execute%20KQL%20queries%20in%20Sentinel%20Notebooks%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2109999%22%20slang%3D%22en-US%22%3E%3CP%3EHi.%20I%20have%20installed%20kqlmagic%20library%20and%20trying%20to%20connect%20to%20my%20log%20analytics%20workspace%20to%20execute%20the%20kql%20queries%20in%20Notebooks.%20Can%20anyone%20help%20me%20the%20different%20approaches%20on%20how%20to%20connect%20to%20the%20specific%20workspace%20and%20execute%20kql%20queries%20in%20Notebooks%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20aware%20of%20this%20below%20approach%20on%20connecting%20to%20the%20specific%20workspace%20and%20executing%20kql%20queries%2C%20but%20I'm%20looking%20for%20another%20way%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%25kql%20loganalytics%3A%2F%2Ftenant%3DTENANT_ID%3Bclientid%3DCLIENT_ID%3Bclientsecret%3DAPP_ID%3Bworkspace%3DWORKSPACE_ID%3Balias%3D'azsecdb'%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2110155%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20execute%20KQL%20queries%20in%20Sentinel%20Notebooks%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2110155%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F923986%22%20target%3D%22_blank%22%3E%40printscreen%3C%2FA%3E%26nbsp%3BThis%20Azure%20Sentinel%20notebook%20gives%20a%20few%20ways%20%22A%20Getting%20Started%20Guide%20For%20Azure%20Sentinel%20ML%20Notebooks%22.%26nbsp%3B%20%26nbsp%3BThis%20is%20definitely%20a%20good%20notebook%20to%20go%20through%20as%20it%20gives%20you%20an%20overview%20of%20what%20the%20notebooks%20can%20do.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThere%20is%20a%20PowerShell%20version%20of%20this%20as%20well%2C%26nbsp%3BA%20Getting%20Started%20Guide%20for%20Azure%20Sentinel%20notebooks%20with%20PowerShell%2C%26nbsp%3B%20if%20you%20prefer%20to%20use%20PowerShell%20instead%20of%20Python.%26nbsp%3B%20It%20does%20not%20use%20the%20kqlmagic%20library%20but%20rather%20makes%20PowerShell%20calls%20to%20get%20the%20Azure%20Sentinel%20information%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Contributor

Hi. I have installed kqlmagic library and trying to connect to my log analytics workspace to execute the kql queries in Notebooks. Can anyone help me the different approaches on how to connect to the specific workspace and execute kql queries in Notebooks?

 

I'm aware of this below approach on connecting to the specific workspace and executing kql queries, but I'm looking for another way?

 

%kql loganalytics://tenant=TENANT_ID;clientid=CLIENT_ID;clientsecret=APP_ID;workspace=WORKSPACE_ID;alias='azsecdb'

 

1 Reply

@printscreen This Azure Sentinel notebook gives a few ways "A Getting Started Guide For Azure Sentinel ML Notebooks".   This is definitely a good notebook to go through as it gives you an overview of what the notebooks can do.

 

There is a PowerShell version of this as well, A Getting Started Guide for Azure Sentinel notebooks with PowerShell,  if you prefer to use PowerShell instead of Python.  It does not use the kqlmagic library but rather makes PowerShell calls to get the Azure Sentinel information