Share via

Resource users/{id}/authentication/methods lots of http 429 return codes (too many requests error)

Sander Klaassen 41 Reputation points
2025-06-12T07:03:59.5033333+00:00

Hi,

In a large inventory script one of the lists it generates contains all registered MFA methods for all users.

My environment has 10k users, querying the resource sequentially takes many hours, so I made it multithreaded.
In other functions in the same inventory script, I use multithreading aswell and is a lot quicker.

However, querying "users/$UserId/authentication/methods" generates many (1000+) retries and takes 35 minutes to complete, while a similar multi threaded query on to list all group members of ~7500 groups using "groups/$GroupId/members" takes 5 minutes.

Is this difference caused by an issue in the MSgraph backend? or is there something I can fix on my end to improve performance?

Cheers,

Sander

Microsoft Security | Microsoft Entra | Microsoft Entra ID
0 comments No comments

1 answer

Sort by: Most helpful
  1. Danstan Onyango 3,996 Reputation points Microsoft Employee
    2025-08-19T14:38:18.3+00:00

    Several factors can cause the throttling you are experiencing. From the docs

    It's possible to receive 429 Too Many Requests responses even when the following limits aren't reached, in situations when the services are under an important load or based on data volume for a specific tenant. The following table lists existing limits.

    In your case since you actually got 429, its throttling so you have to ivestigate the requests a per this doc to find the resource unit cost of the requests progressively through the life cycle of your scrip[t execution. Avoid concurrency that will cause throttling. Note that sometimes even other requests like the group script if that run first will impac the RCU for the authentication methods.

    You may also want to try batch requests where applicable instead of concurrency.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.