Get the shared tenant ids of an app

Yang Jing (景阳) 1 Reputation point

I made an app registration App1 in Tenant1, and shared gallery VM images across Azure tenants from Tenant2 following this doc:

Now assume I have App1 and Tenant1, and I don't know the shared tenant ids (e.g.Tenant2), is there any way to get them by powershell or azure sdk?

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
18,715 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. JamesTran-MSFT 36,056 Reputation points Microsoft Employee

    @Yang Jing (景阳)
    Thank you for your post!

    For your specific question - If you only have the Azure AD App and don't know the shared tenant's ID, is there a way for you to get the Tenant ID?

    There are a few ways to get a Tenant's ID as described in our - How to find your Azure Active Directory tenant ID documentation. However, if you only have the Azure AD App (i.e. Name, Object ID, or Application ID), you can use some Azure AD PowerShell commands to find the tenant ID.

    Note: You'll have to login to the App's tenant prior to running these commands. If you aren't a member of the tenant, you won't be able to get the Tenant ID using these commands.

    #Connect to Azure AD  
    #Get an application by display name  
    Get-AzureADApplication -Filter "DisplayName eq 'TestName'"  
    #Get an application by App ID  
    Get-AzureADApplication -Filter "AppId eq '...02b43a4d37b8'"  
    #Get an application by Object ID  
    Get-AzureADApplication -ObjectId "...02b43a4d37b8"  
    #Get details for a tenant  
    $ObjectId = "...02b43a4d37b8"  



    I hope this helps!

    If you have any other questions, please let me know.
    Thank you for your time and patience throughout this issue.


    Please remember to "Accept Answer" if any answer/reply helped, so that others in the community facing similar issues can easily find the solution.