I cannot retrieve any signIn data from our Azure US Gov tenant with the following Powershell:
$ClientID = "<my app id>"
$ClientSecret = "<app key>"
$loginURL = "https://login.microsoftonline.us"
$tenantdomain = "<my tenant name>"
$scope = "https://graph.microsoft.com/.default"
$body = @{grant_type="client_credentials";client_id=$ClientID;client_secret=$ClientSecret;scope=$scope}
$oauth = Invoke-RestMethod -Method Post -Uri $loginURL/$tenantdomain/oauth2/v2.0/token -Body $body
$url = "https://graph.microsoft.com/beta/auditLogs/signIns"
$headerParams = @{'Authorization'="$($oauth.token_type) $($oauth.access_token)"}
Invoke-WebRequest -UseBasicParsing -Headers $headerParams -Uri $url
We have AAD P2 licenses and the application has the required permissions to read the audit log data.
The same code works against our commercial tenant (after modifying the $loginURL
appropriately.
I know the API is still beta, but I was hoping someone can confirm if it should or should not work against a Gov tenant.
I do not receive any errors, I just receive no data:
Content : {"@odata.context":"https://graph.microsoft.com/beta/$metadata#auditLogs/signIns","value":[]}
Any help appreciated!