You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Azure Management SecurityInsight SDK for Python provides tools for managing Azure Sentinel (Microsoft Sentinel) resources, including incidents, alert rules, data connectors, bookmarks, watchlists, and other security-related resources.
Installation
pip install azure-mgmt-securityinsight
Authentication
fromazure.identityimportDefaultAzureCredentialfromazure.mgmt.securityinsightimportSecurityInsights# Initialize the clientclient=SecurityInsights(
credential=DefaultAzureCredential(),
subscription_id="your-subscription-id"
)
Client Class
SecurityInsights
Primary client class for interacting with Microsoft Sentinel.
Rules that use Fusion technology to detect advanced threats.
MLBehaviorAnalyticsAlertRule
Machine learning-based behavioral analytics.
MicrosoftSecurityIncidentCreationAlertRule
Creates incidents from Microsoft security alerts.
NrtAlertRule
Near-real-time alert rules for faster detection.
ScheduledAlertRule
Rules that run on a schedule with KQL queries.
ThreatIntelligenceAlertRule
Rules based on threat intelligence.
Entity Types
Entity Type
Description
AccountEntity
User account entities.
AzureResourceEntity
Azure resource entities.
CloudApplicationEntity
Cloud application entities.
FileEntity
File entities.
FileHashEntity
File hash entities.
HostEntity
Computer/device entities.
IoTDeviceEntity
IoT device entities.
IPEntity
IP address entities.
MailboxEntity
Email mailbox entities.
MailClusterEntity
Email cluster entities.
MailMessageEntity
Email message entities.
MalwareEntity
Malware entities.
ProcessEntity
Running process entities.
RegistryKeyEntity
Registry key entities.
RegistryValueEntity
Registry value entities.
SecurityGroupEntity
Security group entities.
UrlEntity
URL entities.
DataConnector Types
Data Connector Type
Description
AADDataConnector
Azure Active Directory data connector.
ASCDataConnector
Azure Security Center data connector.
AwsCloudTrailDataConnector
AWS CloudTrail data connector.
AwsS3DataConnector
AWS S3 data connector.
CodelessApiPollingDataConnector
Codeless API polling data connector.
CodelessUiDataConnector
Codeless UI data connector.
Dynamics365DataConnector
Dynamics 365 data connector.
MDATPDataConnector
Microsoft Defender ATP data connector.
MCASDataConnector
Microsoft Cloud App Security data connector.
OfficeDataConnector
Office 365 data connector.
TIDataConnector
Threat Intelligence data connector.
TiTaxiiDataConnector
TAXII Threat Intelligence data connector.
AutomationRule
Property
Type
Description
actions
List[AutomationRuleAction]
The actions to perform when the rule is triggered.
display_name
str
The display name of the automation rule.
enabled
bool
Whether the rule is enabled.
order
int
The order of the automation rule.
triggering_logic
AutomationRuleTriggeringLogic
The conditions that trigger the automation rule.
Watchlist
Property
Type
Description
description
str
The description of the watchlist.
display_name
str
The display name of the watchlist.
items_search_key
str
The key to search for items in the watchlist.
provider
str
The provider of the watchlist.
source
str
The source of the watchlist data.
Bookmark
Property
Type
Description
created_by
UserInfo
Information about who created the bookmark.
display_name
str
The display name of the bookmark.
labels
List[str]
Labels associated with the bookmark.
notes
str
Notes about the bookmark.
query
str
The query that defines the bookmark.
query_result
str
The result of the query.
Important Enums
IncidentSeverity
Value
Description
High
High severity.
Informational
Informational severity.
Low
Low severity.
Medium
Medium severity.
IncidentStatus
Value
Description
Active
Incident being investigated.
Closed
Resolved incident.
New
New incident.
IncidentClassification
Value
Description
BenignPositive
Suspicious but not malicious.
FalsePositive
False positive.
TruePositive
Confirmed malicious activity.
Undetermined
Undetermined classification.
AlertRuleKind
Value
Description
Fusion
Fusion alerts (advanced correlation).
MLBehaviorAnalytics
Machine learning behavior analytics alerts.
MicrosoftSecurityIncidentCreation
Microsoft security alerts.
NRT
Near-real-time alerts.
Scheduled
Scheduled query rules.
ThreatIntelligence
Threat intelligence alerts.
EntityKind
Value
Description
Account
User accounts.
AzureResource
Azure resources.
CloudApplication
Cloud applications.
File
Files.
FileHash
File hashes.
Host
Computers and devices.
IP
IP addresses.
IoTDevice
IoT devices.
Mailbox
Email mailboxes.
MailCluster
Email clusters.
MailMessage
Email messages.
Malware
Malware.
Process
Processes.
RegistryKey
Registry keys.
RegistryValue
Registry values.
SecurityGroup
Security groups.
URL
Web URLs.
DataConnectorKind
Value
Description
AmazonWebServicesCloudTrail
AWS CloudTrail connector.
AmazonWebServicesS3
AWS S3 connector.
APIPolling
API polling connector.
AzureActiveDirectory
Azure AD connector.
AzureAdvancedThreatProtection
Azure ATP connector.
AzureSecurityCenter
Azure Security Center connector.
Dynamics365
Dynamics 365 connector.
GenericUI
Generic UI connector.
IOT
IoT connector.
MicrosoftCloudAppSecurity
Microsoft Cloud App Security connector.
MicrosoftDefenderAdvancedThreatProtection
Microsoft Defender ATP connector.
MicrosoftThreatIntelligence
Microsoft Threat Intelligence connector.
MicrosoftThreatProtection
Microsoft Threat Protection connector.
Office365
Office 365 connector.
Office365Project
Office 365 Project connector.
OfficeATP
Office ATP connector.
OfficeIRM
Office IRM connector.
OfficePowerBI
Office Power BI connector.
ThreatIntelligence
Threat Intelligence connector.
ThreatIntelligenceTaxii
TAXII Threat Intelligence connector.
Usage Examples
Example: Initialize the Client
fromazure.identityimportDefaultAzureCredentialfromazure.mgmt.securityinsightimportSecurityInsights# Authenticate using default credentialscredential=DefaultAzureCredential()
subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"# Initialize the clientclient=SecurityInsights(
credential=credential,
subscription_id=subscription_id
)
Example: List All Incidents
# List all incidents in a workspaceincidents=client.incidents.list(
resource_group_name="myResourceGroup",
workspace_name="myWorkspace"
)
forincidentinincidents:
print(f"Incident: {incident.name}, Status: {incident.properties.status}, Severity: {incident.properties.severity}")