Я могу просто дать приблизительную ссылку.
После установки пакета azure-mgmt-security следует использовать в пакете метод List
, исходный код которого здесь .
Вот документ о том, как пройти аутентификацию.
Вот doc о том, как получить tenantId / client_id / key.
Вот мой код:
from azure.mgmt.security import SecurityCenter
from azure.common.credentials import ServicePrincipalCredentials
subscription_id = "xxxx"
# Tenant ID for your Azure subscription
TENANT_ID = '<Your tenant ID>'
# Your service principal App ID
CLIENT = '<Your service principal ID>'
# Your service principal password
KEY = '<Your service principal password>'
credentials = ServicePrincipalCredentials(
client_id = CLIENT,
secret = KEY,
tenant = TENANT_ID
)
client = SecurityCenter(credentials=credentials,subscription_id=subscription_id,asc_location="centralus")
client.alerts.list()
Также вы можете использовать List Alerts api с запросом http в python.