How can i retrieve all the azure ad applications using graph api call?

Mohammed Siddiq Cheruvu 0 Reputation points
2023-05-12T14:39:50.7566667+00:00

I am trying to retrieve azure ad apps using the below graph api call.

https://graph.microsoft.com/v1.0/applications?$count=true&$select=displayname,appId,passwordCredentials

But it is returining only 100 results. But i need to return all the apps (i have more than 5000 apps in azure ad) in a single query.

How an i retrieve all azure ad apps at one go?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,138 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
20,210 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Vasil Michev 98,681 Reputation points MVP
    2023-05-12T16:31:40.8966667+00:00

    You need to use pagination, as detailed here: https://learn.microsoft.com/en-us/graph/paging

    You can use this as example on how to do pagination via PowerShell:

    $Apps = @()
    
    $uri = "https://graph.microsoft.com/beta/applications?`$top=999"
    
    do {
        $result = Invoke-WebRequest -Method Get -Uri $uri -Headers $authHeader
        $uri = ($result.Content | ConvertFrom-Json).'@odata.nextLink'
    
        $Apps += ($result.Content | ConvertFrom-Json).Value
    } while ($uri)