As Microsoft sunsets the AzureAD module, administrators managing directory configurations—like domain settings—must transition to the Microsoft Graph PowerShell SDK. One of the commonly used AzureAD cmdlets, Get-AzureADDomain, was used to retrieve details about verified and unverified domains in a tenant.
The modern and fully supported alternative is Get-MgDomain. This article walks you through how to migrate, demonstrates the new usage patterns, and explains what’s different in the Graph-based approach.
Using Get-AzureADDomain, you could list all domains configured in the tenant, or retrieve specific details about a particular domain.
Get-AzureADDomain
Get-AzureADDomain -Name "example.com"
This approach worked well but was limited to AzureAD’s scope and lacked extensibility for advanced filtering and property selection.
In Microsoft Graph PowerShell, the replacement cmdlet is Get-MgDomain. It provides the same functionality, with enhanced property control and Graph-native extensibility.
Get-MgDomain
This fetches all domains configured in your Microsoft 365 tenant.
Get-MgDomain -DomainId "example.com"
You can use the domain name itself as the DomainId.
Get-MgDomain -Property Id,IsVerified,IsDefault
This helps you optimize scripts or audits by limiting output to only the fields you need.
Get-MgDomain -All | Where-Object { $_.IsVerified -eq $true } |
Select-Object Id, IsVerified, AuthenticationType
This is especially useful in large tenants where you want to quickly list domains that have been verified and are actively used.
🔄 Old (Get-AzureADDomain) | ➡️ New (Get-MgDomain) |
Parameter: -Name | Parameter: -DomainId |
Limited output customization | Supports -Property for selective data retrieval |
AzureAD module (deprecated) | Microsoft.Graph.Identity.DirectoryManagement |
Static, tenant-only | Graph-native for multi-tenant and automation use |
Switching from Get-AzureADDomain to Get-MgDomain is not just about future-proofing your scripts — it’s about gaining greater control, flexibility, and Graph-native power. Whether you're auditing domain configurations, filtering for verified domains, or scripting detailed domain reports, Get-MgDomain enables smarter, modern M365 administration.
Visit M365Corner.com for ready-to-use free Microsoft Graph PowerShell tools and step-by-step migration guides built for Microsoft 365 administrators.
© Your Site Name. All Rights Reserved. Design by HTML Codex