@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
Connect-AzureAD
#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"
(Get-AzureADTenantDetail).ObjectId
Links:
Get-AzureADApplication
Get-AzureADTenantDetail
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.