Reputation: 1516
I need to get a users from Azure Active directory who were created/modified since a specific date. Is this possible, via graph or any other means?
I have checked the graph api documentation but cannot see a lastModified filter.
Upvotes: 1
Views: 2953
Reputation: 380
Probably lstModifiedDate
is not exposed by design, to prevent developers going in this direction. Instead, GraphAPI exposes Delta Queries which return not only modified entities but also created and deleted.
Delta query for users example.
Upvotes: 0
Reputation: 22512
There is no such property called lastModifiedDateTime
in Microsoft Graph.
As @Tiny Wang suggested, you can query using createdDateTime
.
From Azure CLI, to get Azure AD users created since a specific date, make use of below command:
az ad user list --filter "createdDateTime ge datetime'yyyy-MM-ddTHH:mm:ssZ'"
From Microsoft Graph API, to get Azure AD users created since a specific date, make use of below command:
https://graph.microsoft.com/beta/users?$filter=createdDateTime ge yyyy-MM-ddTHH:mm:ssZ &$select=displayName,createdDateTime,id
Before using the above command, make sure to give the below permissions:
References:
Microsoft Graph User last modified field - Stack Overflow
Get a user - Microsoft Graph beta | Microsoft Docs
Upvotes: 1
Reputation: 20725
As mentioned in the comment there is no modifiedDateTime
or similar property on User
resource type.
If you want to filter users who were created since a specific date then you can use createdDateTime
property.
Example to get users created since 01/01/2022
GET /users?$filter=createdDateTime ge 2022-01-01T00:00:00Z
Example to get users created in 2021
GET /users?$filter=(createdDateTime ge 2021-01-01T00:00:00Z AND createdDateTime le 2021-12-31T23:59:59Z)
Upvotes: 0