Forum Discussion

  • pvanberlo's avatar
    pvanberlo
    Steel Contributor
    There are no "out of the box" alerts around new user creation unfortunately. What you could do is leverage the Graph API and subscriptions to monitor user changes, or alternatively you can use the audit log to search for any activities for new user creation during a specific period. The latter would be a manual action, and the first would be complex to do unfortunately.
    • Happyter's avatar
      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's avatar
        pvanberlo
        Steel 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.

    • pvanberlo's avatar
      pvanberlo
      Steel Contributor

      Forgot about that page! Why on earth they removed the activity for "Added user" on the new policy page is beyond me 😞 Let's hope this is still "work in progress" and it'll re-appear someday 🙂

      • Yeah the portals and all the moving around is quite a mess really 🙂 I'm pretty sure there's work in progress though.
      • Let me know if it fits your business needs and if so please "mark as best response" to close the conversation. Thanks.

Resources