New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get-AzTenant and Get-AzContext not returning tenant name when connecting with a serviceprincipal #24729
Comments
@BethanyZhou please check if this is a limitation of the Entra ID APIs. |
Hi @syspro-chrisvogt , thanks for reaching out to us.
|
Hi @BethanyZhou
If I connect interactively, specifying the tenant ID, then when using Get-AzTenant, it returns the list of tenants I have access to. If I need to do something with one of the other tenants, I do need to authenticate still, but at least I can see the list of tenants and, at a minimum, the current tenant's name. If I connect using a service principal and specify the tenant ID (with access to the same tenants and the same level of permissions/role assignments as the user mentioned above), then Get-AzTenant only returns the current tenant but does not include the tenant name. I've re-tested the Get-AzContext bit and see that the tenant name is not returned, regardless of the login method used. My current use case is that I am trying to return the list of reservations expiring within a certain number of days. Unfortunately you have to connect to each tenant to do this and cannot use Lighthouse. What I have written thus far gets the list of tenants (dynamically) and returns this information from each tenant. With Get-AzTenant not returning the list of "available" tenants I will need to hardcode or look this up elsewhere, and this lookup (wherever it is) will now need to be maintained too. By extension, for reporting purposes because it does not return the name means the output is not in a user-friendly format. Again, this can be looked up elsewhere... this just means, though, that things can be missed. |
Description
Get-AzTenant and Get-AzContext does not return tenant name when connecting with a serviceprincipal. This is similar to those reported on #10767, #20075, and #22887.
I am logging this separately as #22887 has this listed as a feature request, but I believe this to be a bug for three reasons:
Issue script & Debug output
Environment data
Module versions
Error output
The text was updated successfully, but these errors were encountered: