Search code examples
azureauthenticationloggingazure-ad-b2caudit

Access Azure B2C Sign-In logs after 90 Days


We are trying to overcome a situation where we need to delete the users from Azure B2C directory who have not logged in for more than 90 days. I am using the graph API, but it returns me the login history for max 30 days.

All searches I made direct me audit logs of Azure AD and not B2C (i presume, they are not the same). The graph API as well that i found for B2C was for audit logs and not just the sign in logs, which is also in beta version of the API only.

I need either help or alternatives on how this could be achieved. Thanks in advance.


Solution

  • You can create a custom policy that is based on this sample policy which:

    • Creates a custom attribute called extension_lastLogonTime
    • Updates this attribute value on sign-in

    You can then execute an Azure AD API query for users that haven't signed in for 90 days or more.