In this blog post about Microsoft 365 PowerShell, I will show you how to get a full list of all your Microsoft 365 verified domains using PowerShell.
Azure AD PowerShell
In this post, I will use the Microsoft Azure AD PowerShell module which runs on Windows and requires PowerShell 5.1 (not PowerShell 7).
Get-AzureADTenantDetail
The PowerShell cmdlet that allows us to tap into the verified domains object in Microsoft 365 (formally Office 365) is Get-AzureADTenantDetail however in order to extract the entire object I will first need to save to output into a variable and then output each domain using foreach-object.
Below is the first cmdlet that will save the output to a variable.
$x = Get-AzureADTenantDetail
To output all the domains to the screen I will run the cmdlet below.
$x.VerifiedDomains | ForEach-Object {$_.name}