I am trying to retrieve security events and/or alerts from the Microsoft Graph Security API. The end goal is to get EOP events.
When I submit the request:
GET https://graph.microsoft.com/v1.0/security/alerts
I get this:
HTTP/1.1 206 Partial Content
Cache-Control: private
Warning: 199 - "Microsoft/WDATP/401/16"
Content-Type: application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8
request-id: [REDACTED]
client-request-id: [REDACTED]
x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"West US","Slice":"SliceC","Ring":"5","ScaleUnit":"003","Host":"AGSFE_IN_22","ADSiteName":"WUS"}}
OData-Version: 4.0
Duration: 399.4425
Strict-Transport-Security: max-age=31536000
Date: Thu, 18 Oct 2018 00:36:42 GMT
Content-Length: 90
{"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#Security/alerts","value":[]}
I feel it's worth noting that I see an alert for a phishing campaign with 11 attempts total and 1 attempt today on the Office 365 Security and Compliance Center's Reports Dashboard (what a mouthful).
I tried to treat it like a proper 206, but Accept-Ranges is not set, HEAD
is not allowed, and passing Range: bytes=0-10000
changes nothing. I also noticed the Warning: 199 - "Microsoft/WDATP/401/16"
header, which follows {Vendor}/{Provider}/{StatusCode}/{LatencyInMs}, but I am unsure why it is occurring. Even if it is occuring, I need EOP logs, not Windows Defender ATP logs, so I am hoping I can ignore this.
Additional info:
Authorization
header (except for when I was messing around with the Range
header). I have also tried this with Fiddler.EDIT: SOLUTION FOR EOP LOGS
I finally found an endpoint to programmatically get EOP logs. The user accessing it can't have MFA and there is some poorly documented rate limiting, but otherwise it looks good. For details, see this page. Specifically, I GET
this page to view my permissions, and GET
this page to view the messages (don't be fooled by your browser's RSS feed view, there is a lot of data there).
The reason you are not getting any alerts back from the Security API is because Office 365 is not fully integrated to the API today. Office 365 is listed as coming soon on the list of current providers on the Microsoft Graph Security API page.
From the warning header you received, it looks like you have a WDATP subscription but don't have the required role in WDATP.
In order to get alerts from WDATP the user must have the correct roles to view the alerts. Permissions needed in WDATP are View data
to access the portal and the API to GET alerts, and Investigate alerts
to PATCH alerts in WDATP. For steps to add the required roles, read Create and manage roles for role-based access control.
If you want to get alerts from the Security API you could register for a trial with Azure Security Center and generate an alert in your tenant.
How to Generate an ASC Alert: After the Security Center agent is installed on your computer, follow the steps below from the computer where you want to be the attacked resource of the alert: