Forum Discussion
O365 last logon
Hello Bupeshkumar Rajendiran,
Finding a last-logon using the audit log is quite challenging. If you go with the PowerShell then you need to retrieve all the data and compute the statistics by iterating the result or you may store the data in a database which you can run a query against. Also, note that you can find the last login information only if the user logged in the past 90 days as Microsoft only preserve the audit log for last 90 days by default. Preserving beyond this limit is also quite challenging.
I believe you are looking for a report http://demo.admindroid.com/#/audit/azure/reports/20164/1/20. Instead of developing the solution on your own, the better way is to use the pre-built solution which takes care of preserving the data over the retention limit, timely sync, etc.