'Get-MgAuditLogSignIn -All - different outputs each time I run the command
I am using MgGraph with the beta profile. Each time I run my script (it should grab all the sign-ins from the previous day) I get a different number of records - 14k, 12k, 7k... The same request, the same filters, just run the same script once again and once again. Is there any limit for requests (like once in a day or in an hour or something else)? This is how I am downloading:
Connect-MgGraph -ClientId XYZ -TenantId ABC -Certificate $cert
Select-MgProfile -Name beta
#Create a yesterday date
#Note - this is UTC
$yesterdayDate = (Get-Date).AddDays(-1).AddHours(-(Get-Date).Hour).AddMinutes(-(Get-Date).Minute).AddSeconds(-(Get-Date).Second).AddMilliseconds(-(Get-Date).Milliseconds)
Write-Host
Write-Host "Downloading data... Start time:" $(Get-Date -Format "hh:mm:ss")
$signIns = Get-MgAuditLogSignIn -All -Filter "CreatedDateTime gt $($yesterdayDate.ToString("yyyy-MM-ddTHH:mm:ssZ")) and CreatedDateTime lt $($yesterdayDate.AddHours(24).ToString("yyyy-MM-ddTHH:mm:ssZ")) and ClientAppUsed ne 'Browser' and ClientAppUsed ne 'Mobile Apps and Desktop clients' and ClientAppUsed ne ''"
Write-Host "Done downloading data... End time:" $(Get-Date -Format "hh:mm:ss")
The same result, actually, I am getting using the v1.0 graph.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
