The Azure PowerShell Get-AzSubscription cmdlet shows the tenantID for each subscription, allowing you to identify whether a returned subscription belongs to your service provider tenant or to a managed customer tenant.
When using the Get-AzSubscription cmdlet the subscriptions with delegations from a customer tenant are shown with the MSP's Azure AD Tenant ID and not the customer's.
Unsure if this description is incorrect or the cmdlet is returning an unexpected result.
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
@Snozzberries Thank you for the feedback. We will work on it and will keep you updated on the thread
For additional context and reproduction, I have two Azure AD tenants. An MSP Azure AD tenant (1a7c), and a Customer Azure AD tenant (ed2f). Within the customer tenant there exists a subscription (*0b89).
When I am authenticated to the MSP tenant without specifying a TenantId or SubscriptionId for Connect-AzAccount I am able to see the customer subscription with a TenantId of the MSP (*1a7c) when I run Get-AzSubscription.
If I subsequently Clear-AzContext and Connect-AzAccount -SubscriptionId *0b89 -TenantId *ed2f (Azure Delegated Resource Management role assignments have been created outside of Lighthouse) and issue Get-AzSubscription the TenantId is returned as the currently authenticating Azure AD tenant ID (*ed2f).
Thanks @Snozzberries for all the details and for reporting the issue. We have confirmed that Get-AzSubscription does not currently show the customer's TenantId, as you have observed. I've created a PR to update the docs accordingly. When it merges, this issue will automatically close. The update will appear in the topic shortly after that. Thanks again for your feedback!
Hi again @Snozzberries - wanted to let you know that we've updated this article again, as the Azure PowerShell Get-AzSubscription cmdlet will now show the HomeTenantId and ManagedByTenantIds attributes for each subscription. Please give it a try and let us know if you have further questions!
Works perfectly @JnHs, thank you for the update!