Getting a list of all users last login status and date based on a criteria on AzureAD

Flávio Neto 1 Reputation point

I don't know if this is the correct place to post this question, but I can't seem to find a way to do this in a elegant way.

The use case is this:
I create a group of users using PowerShell from CSV formatted for the occasion, and then mail merge their temporary passwords into an email.
This is for an online only adult IT lessons, so we are speaking of people that will struggle with mandatory MFA or even with just the concept of using the username and password we sent them, so I have to check if users have tried to log in during the days after the user creation and prior to their first session.
This is OK, for now as our cohorts are 30/40 people and I can check the 0365 admin centre, but at the rate of growth, it will become unfeasible (I already had a bit of trouble with the last cohort of around 40ish users).

I've thought have telling people to let me know if they were able to login, as a sort of virtual hello and present! kind of deal, but getting people to read their emails is too much sometimes.
So i need a command that tells what the login status of users, bonus if I can get something that does a "For-each" based on the list on the original CSV.

Another possibility is something that tells me the login status based on the group, as they are all added to the same course group on creation, or based on a piece of info, like for example, I tag them by defining the State (as in location, I am based on the UK so that field is basically free real estate and it has come in sue for filtering) with something like Front305.
Any suggestions?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
9,898 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. 2022-06-24T00:59:08.69+00:00

    The following query can be used to Users last sign-in data:$select=signInActivity  


    Please refer this document for more information on signInActivity as its available on Beta endpoint its not recommended for Production environments:

    There is known issue with signInActivity:

    0 comments No comments