Forum Discussion

Bas Wijdenes's avatar
Bas Wijdenes
Copper Contributor
Jul 19, 2018

PowerShell Risky Sign In events shows 100 entries

Hi All,

 

I'm using PowerShell to write the Risky Sign In events to a CSV-file. 

It only shows 100 entries though, I think I'm overseeing something easy, but can you help me out? 

 

 $loginURL = "https://login.microsoft.com"
$resource = "https://graph.microsoft.com"
$body = @{grant_type = "client_credentials"; resource = $resource; client_id = $ClientID; client_secret = $ClientSecret}
$oauth = Invoke-RestMethod -Method Post -Uri $loginURL/$tenantdomain/oauth2/token?api-version=1.0 -Body $body
Write-Output $oauth
if ($oauth.access_token -ne $null)
{
$headerParams = @{'Authorization' = "$($oauth.token_type) $($oauth.access_token)"}
$url = "https://graph.microsoft.com/beta/identityRiskEvents"
Write-Output $url
$myReport = (Invoke-WebRequest -UseBasicParsing -Headers $headerParams -Uri $url)
foreach ($event in ($myReport.Content | ConvertFrom-Json).value)
{
Write-Output $event
}
}
else
{
Write-Host "ERROR: No Access Token"
} }

 

That's the part I'm using to get all info, yet it's only 100 entries.. 

 

Resources