Forum Discussion
Robert Bollinger
May 05, 2020Brass Contributor
Search-UnifiedAuditLog - List of users.
Hey Guys,
Trying to generate a report of users who logged into office 365 and/or their mailbox. Just need to be able to use an input file.
I found this script here:
To Generate the Data
$ConvertAudit = Search-UnifiedAuditLog -StartDate "04-01-2020" -EndDate "04-10-2020" -UserIds "robert@domain.com" -ResultSize 5000
To produce the report:
$ConvertAudit | Select-Object -ExpandProperty AuditData | ConvertFrom-Json | Select-Object CreationTime,UserId,Operation,Workload,ObjectID,SiteUrl,SourceFileName,ClientIP,UserAgent
The script is great! It allows you to export data for a single user, and format that data from JSON to Excel. This is what i needed!!
The only problem i am having is i want to be able to use the above script and run it against an input file. The input file would have a list of users email addresses. (PrimarySMTP).
I have tried to "fix it myself" and have not gotten anywhere. Any help would be appreciated.
Thanks,
Robert
Why don't you simply export the sign-in logs from the Azure AD portal?
- Robert BollingerBrass Contributor
Hey Vasil, Because i need to be able to run this against a list of users, and also i didn't see that the audit log reports in office (Sec and Compliance) reported the last sign in date.
Also there is more data in the script below than is provided by the canned audit log reports in the sec and comp center.
Thanks,
Robert
I'm referring to the sign-in logs in the Azure AD portal, which are the source of truth when it comes to the "last logged" date, it flows from there to the SCC. https://docs.microsoft.com/en-us/azure/active-directory/reports-monitoring/concept-sign-ins