That's very likely the reason, yes. "Eventual" consistency by design means that you will get a response before all the copies are updated with the latest changes, so the output is not always current. Even without the consistency header, replication can add some delay. This is usually noticeable in the UI, but direct Graph queries are not an exception, at least in my experience.
Can't fetch user count correctly after creating user with GraphAPI
request
GET https://graph.microsoft.com/v1.0/users?$filter=(userPrincipalName eq '******@xyz.com')&$count=true
header
ConsistencyLevel : eventual
As I was testing the graphAPI, I encountered this strange behavior. I was getting count : 0, seconds after creating user ******@xyz.com using the above given request. This is strange because user has been created but is not being reflected. After few seconds however, the same request is reflecting the user and user count correctly.
- Why is there a time delay between creating and fetching user with count parameter?
- How much is this time delay exactly?
- Is this happening because of
ConsistencyLevel: eventual ?
I have attached images of the same behavior below.
Created User
Got Count after few seconds of creation
Works fine again after some time.
Microsoft Security | Microsoft Graph
-
Vasil Michev 123.7K Reputation points MVP Volunteer Moderator2022-07-07T10:49:35.623+00:00