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:
- I set up the app following this document (except I granted SecurityEvents.Read.All as an application permission).
- I am using Python requests, and am only setting the
Authorization
header (except for when I was messing around with theRange
header). I have also tried this with Fiddler. - My organization has EOP (comes with Exchange), but not Office 365 ATP. Getting ATP working would be nice, but is not necessary. Getting EOP logs/events/alerts/whatever is my mail goal.
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).