Search code examples
azureazure-active-directorymicrosoft-entra-id

How to find the tenant where a multi-tenant AAD application was registered


I am trying to find in which of our test tenants an AAD application was registered. I know the application registration exists as I can successfully instantiate a new service principal for it in a different tenant:

New-AzADServicePrincipal -ApplicationId <app-id-for-MyTestApplication>
# I see that a service principal for app MyTestApplication is created

Is there a way for me to find the home tenant given the app ID?


Solution

  • Get-AzADServicePrincipal -ApplicationId "xxxxxxxx" | ConvertTo-Json -Depth 5
    

    Get the return result:

    {
        "AccountEnabled":  true,
        "AddIn":  [
    
                  ],
        "AlternativeName":  [
    
                            ],
        "AppDescription":  null,
        "AppDisplayName":  "wbxxxxxx",
        "AppId":  "xxxxxxxxxxxxxxxxx",
        "AppOwnerOrganizationId":  "1111111-3a06-4480-8a1e-11111111",
        "AppRole":  [
    
                    ],
        "AppRoleAssignedTo":  null,
        "AppRoleAssignment":  null,
        "AppRoleAssignmentRequired":  false,
        "ApplicationTemplateId":  null,
        "ClaimsMappingPolicy":  null,
        "CreatedObject":  null,
        "DelegatedPermissionClassification":  null,
        
        ...
    }
    

    AppOwnerOrganizationId is the service principal related app home tenant.