A place for simple scripts!
🔗 https://azure.github.io/azure-sdk/releases/latest/all/python.html
We use the azure-mgmt-securityinsight package to authenticate.
🔗 https://docs.microsoft.com/en-us/azure/developer/python/sdk/authentication-overview
We use the azure-identity package to authenticate.
pip install azure-identity
The simplest way to get an authentication token involves using DefaultAzureCredential which grabs a valid token from your environment. See the link for details.
It can be used as follows:
from azure.identity import DefaultAzureCredential
from azure.mgmt.securityinsight import SecurityInsights
subscription_id = "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
# Acquire a credential object
credential = DefaultAzureCredential()
# Authenticate to an API provider (e.g. Sentinel)
sentinel = SecurityInsights(credential, subscription_id)