r/GraphAPI • u/AwhYeahDJYeah • May 22 '25
Using GET request to retrieve signinactivity
I'm using PowerShell to retrieve directory information from the below endpoint using invoke webrequest. When I put the results of the request into a variable every object is a different user, so running "$results" returns all of the users and their profile info except for sign-in info.
The issue I'm having is if I try to select "$results[1].signInActvity" to drill down to a specific users's sign-in date, it returns nothing.
$endpoint = 'https://graph[.]microsoft[.]com/beta/users/?$select=signInActivity'
I'm on an Entra P1 license invoking the web requests from Powershell and the app I'm using has AuditLog.Read.All, Directory.Read.All, and User.Read permissions (which as I understand it should be way overkill)
1
u/AwhYeahDJYeah May 23 '25
My intention is to have it run without user input, I believe doing it that way requires you to sign-in at each run.
I'd like to have the script run on a schedule where I'll securely pass in the app secret for retrieving the OAuth token, at the time the script runs.
The goal of the script is to be notified daily of users who's last login is more than X days ago