azureazure-active-directoryaz

Get the Azure Directory Name by PowerShell


How can I get the Azure Directory(Tenant) name in which I have logged in by PowerShell ?

I have tried 'Get-AzContext', but it only provides the Tenant ID. Tenant name or default domain name is not included in the output.


Solution

  • Get-AzTenant will help.

    Get-AzTenant
       [[-TenantId] <String>]
       [-DefaultProfile <IAzureContextContainer>]
       [<CommonParameters>]
    

    enter image description here


    Make sure the version of Az is 4.5.0(the latest version). You could Install-Module -Name Az to update it.

    enter image description here