Forum Discussion
Happyter
Aug 16, 2021Copper Contributor
Alert for New Added User
I can't find any resources/guide to create/enable/turn-on an alert for newly added users. Is there such a thing in Office 365 admin center?. I want to monitor newly added user on my domain, and revie...
- Aug 16, 2021Hello, you can use the "legacy" activity alerts https://compliance.microsoft.com/managealerts
Happyter
Copper Contributor
Thanks for your reply, I will be going with the manual action for now as I'm still new with the admin center.
pvanberlo
Aug 16, 2021Steel Contributor
Happyter Once you feel more comfortable with this, a simpler script and Graph API approach could be to use the Graph PowerShell module, the createdDateTime attribute of the user resource. This way you could script this, run the script in scheduled manner and get some kind of output.
Have a look at the Get-MgUser cmdlet. If you run it like:
$Date = (Get-Date).ToUniversalTime().AddMinutes(-15).ToString("yyyy-MM-ddTHH:mm:ssZ")
$NewUsers = Get-MgUser -Filter "createdDateTime ge $Date" -ConsistencyLevel eventual -CountVariable ResultCount
if ($ResultCount -gt 0) {
$NewUsers
}
Would return a list of all users created in the past 15 minutes. You could extend this to take some action like send an email, and schedule the script to run regularly.