Search code examples
azure-active-directorymicrosoft-graph-api

How do i get the the user that created an user in graph


I have been reading the documentation on Microsoft Graph on user properties and i can not find the "Created by user" property.

I have found the "Date of creation" property but does azure even register who created an user?


Solution

  • I created a user, and the activity will show up in the Audit logs like below:

    enter image description here

    To fetch the user that created a user, you can make use of below query to filter Audit Logs:

    GET https://graph.microsoft.com//v1.0/auditLogs/directoryAudits?&$filter=activityDisplayName eq 'Add user'
    

    enter image description here

    The inititatedBy is the user who created the user present in the targetResources.

    Make sure to consent AuditLog.Read.All permission to perform the action.

    Reference:

    Audit logs in Azure Active Directory - Microsoft Entra