azureazure-service-principalazure-app-registration

How can I find all Azure app registrations with API permissions to a specific app registration?


I have an app registration in Azure that exposes an API (let's say the app id is 00000000-0000-0000-0000-000000000001)

There are many app registrations in our tenant that have been granted access to the app roles/user scopes of this app.

How can I find all app registrations in my tenant that have been granted API permissions for this app?

If I go to a specific app that I know has been provided access, I can see in the manifest that it is listed under requiredResourceAccess.resourceAppId.

e.g.
app registration manifest example

I'm looking for a way to find all apps that have been given access to this app. I don't really care if the solution is PowerShell, MS Graph, Azure UI, etc.

Thanks!


Solution

  • I have one Azure app registration named APIapp that exposes an API as below:

    enter image description here

    For sample, I granted this permission to few applications that displays below resourceAppId in App's Manifest:

    enter image description here

    To list all app registrations that have been granted API permissions for this app, you can make use of below sample PowerShell script:

    Connect-MgGraph -Scopes "Application.Read.All"
    
    # Define the App ID of the target app
    $appId = "07323297-dbd0-xxxxxxxx"
    
    $allApps = Get-MgApplication -All
    $filteredApps = $allApps | Where-Object {
        $_.RequiredResourceAccess.ResourceAppId -contains $appId
    }
    
    $filteredApps
    

    Response:

    enter image description here