Share via

Unable to query signinactivity for individual user

Brendan 20 Reputation points
2023-06-19T14:05:44.0633333+00:00

I would like to include signInActivity for an individual user when querying the graph API. I am able to get this information by calling https://graph.microsoft.com/v1.0/users?$select=signInActivity, however, if I try to get the data for a singular user by calling https://graph.microsoft.com/v1.0/users/{UPN}?$select=signInActivity I get a 400 error.

Is this expected behavior? Is sign-in activity only available when querying all users?

Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

Answer accepted by question author
  1. Anonymous
    2023-06-19T16:11:02.6533333+00:00

    Hello Brendan,

    Thanks for reaching out. Selecting the 'signInActivity' resource using UPN is not supported. You need to use the GUID of the user, for example https://graph.microsoft.com/v1.0/users/[GUID]?$select=signInActivity

    Alternatively using you can use the 'auditLogs' endpoint to get user signin info by UPN as below:

    https://graph.microsoft.com/v1.0/auditLogs/signIns?$filter=userPrincipalName eq 'UPN'

    If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.

    Thanks.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2023-06-21T14:01:38.2033333+00:00

    Hello Brendan,

    Good Day. Hope all is well.

    If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.

    Thanks

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.