Get Windows Azure Active Directory Tenant ID in Windows PowerShell

Summary: Get your Windows Azure Active Directory tenant ID in Windows PowerShell.

Hey, Scripting Guy! Question How can I get my Windows Azure Active Directory tenant ID in Windows PowerShell?

Hey, Scripting Guy! Answer Use the Add-AzureAccount cmdlet to add your Windows Azure account to Windows PowerShell:

PS C:> Add-AzureAccount

          Then use Get-AzureAccount to get the tenant ID:

PS C:>(Get-AzureAccount).ActiveDirectories.ActiveDirectoryTenantID