Steven Jin
Steven Jin

Reputation: 53

Microsoft Graph API - Is there a way to get all the service principals?

Using this query https://graph.microsoft.com/beta/serviceprincipals , it shows 100 service principals, whereas the total count is 215 with this query https://graph.microsoft.com/beta/servicePrincipals/$count

How can I get the entire list of serviceprincipals?

Reference: https://learn.microsoft.com/en-us/graph/api/serviceprincipal-list?view=graph-rest-beta&tabs=http

Upvotes: 0

Views: 1321

Answers (2)

Sajeetharan
Sajeetharan

Reputation: 222582

By Default, Most of the REST APIs including Graph API returns a result of 100 records. if you want all the data you need to make use of count and top together or skip which acts similar to pagination.

https://graph.microsoft.com/beta/servicePrincipals/$top="totalCount"

Upvotes: 0

Steven Jin
Steven Jin

Reputation: 53

I used a trick to get all the service principles by adding this query parameter https://graph.microsoft.com/beta/servicePrincipals/$top=215

Upvotes: 0

Related Questions