Buried in my PowerShell Snippets Vol 4 post from 2021 is the PowerShell script and a link to a PowerShell Module I authored named AzureADTenantID. Its sole purpose was to take a domain name (e.g., darrenjrobinson.com) and lookup return any associated Azure AD (now Entra ID) TenantID. I personally use this module quite frequently. Judging by the downloads on it, it is also popular with others.
More recently I’ve needed to also identify quickly any domains associated with an Exchange Online / Entra ID (Azure AD) Tenant. Looking into the Microsoft Documentation this information can be retrieved using Autodiscover.
I’ve updated my module with an additional cmdlet to return Exchange Online Domains which will infer Entra ID Custom Domains if the associated organisation is following the recommendation of UPN matching Email. And of course, that Exchange Online is being used.
Install from the PowerShell Gallery on Windows PowerShell 5.1+ or PowerShell Core 6.x or PowerShell.
Install-Module -name AzureADTenantID
Use the Get-AzureADTenantId or Get-EntraIDTenantId cmdlets to lookup and return the TenantId.
Get-AzureADTenantId -domain 'microsoft.com' or Get-EntraIDTenantId -domain 'microsoft.com'
or
'microsoft.com' | Get-AzureADTenantId or 'microsoft.com' | Get-EntraIDTenantId
The Get-AzureADCustomDomains and Get-EntraIDCustomDomains cmdlets default to WW Cloud
Get-AzureADCustomDomains -domain 'microsoft.com' or Get-EntraIDCustomDomains -domain 'microsoft.com'
For GCC-H use the -GCCH switch
Get-AzureADCustomDomains -domain 'microsoft.com' -GCCH or Get-EntraIDCustomDomains -domain 'microsoft.com' -GCCH
or
'microsoft.com' | Get-AzureADCustomDomains or 'microsoft.com' | Get-EntraIDCustomDomains -GCCH
Today, I’m super excited to finally announce the Beta release of EntraPulse Lite – a…
I'm excited to share some significant authentication enhancements I've contributed to the Lokka MCP Server…
Last month I had the pleasure of speaking at the Sydney event for Global Azure.…
Model Context Protocol (MCP) is a powerful framework that extends AI clients like Claude and…
I've just completed participating in the Azure AI Developer Hackathon that was looking to provide…
Updated: July 2025 v1.0.2 Fixes issue setting D365SalesGlobals enabling session management for D365 Sales API…
This website uses cookies.