Path: blob/master/tutorials-and-examples/feature-tutorials/AzureSentinelAPIs.ipynb
3253 views
Microsoft Sentinel API Calls
MSTICpy versions > 0.8.5
Description
This Notebook provides an example of using the Microsoft Sentinel API features of MSTICpy in order retrieve specific data from Microsoft Sentinel
Installation and imports
Authentication
The first step to be able to use the features is to call the AzureSentinel class and connect to it. Authentication uses the standardized Azure authentication options of using environment variables, Azure CLI credentials, Managed Identities, and interactive logons.
Once connected we need to select a Microsoft Sentinel workspace to get details from. The easies way to do this is with the get_subscriptions() and get_sentinel_workspaces() functions to select the subscription and workspace you with to connect to. If you already know which workspace you wish to connect to you can skip straight to the other functions and enter these details.
Now that we have selected our workspace we can call various functions to get details about content in the workspace. These are typically returned as DataFrames. Below we get a list of hunting queries configured in our workspace.
Hunting queries return the raw queries associated with them, this allows us to pass the query directly to a QueryProvider in order to get the results of the hunting query within the notebook.
We can also get a list of configured alert rules:
We can also get a list of saved bookmarks. To see the events these bookmarks relate to you can pass the query value to a QueryProvider.
We can also interact with Incidents via the API to get a set of all incidents, or a single incident:
You can also interact with an incident - adding comments or changing properties such as severity or status: