Migrating from Get-AzureADDomain to Get-MgDomain

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.


What You Did Previously with Get-AzureADDomain?

Using Get-AzureADDomain, you could list all domains configured in the tenant, or retrieve specific details about a particular domain.

Example: Retrieve All Domains

Get-AzureADDomain

Example: Retrieve a Specific Domain"

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.


What You Should Do Now with Get-MgDomain?

In Microsoft Graph PowerShell, the replacement cmdlet is Get-MgDomain. It provides the same functionality, with enhanced property control and Graph-native extensibility.


Retrieve All Domains

Get-MgDomain

This fetches all domains configured in your Microsoft 365 tenant.

Retrieve a Specific Domain by Domain ID

Get-MgDomain -DomainId "example.com"

You can use the domain name itself as the DomainId.

Retrieve Specific Properties of All Domains

Get-MgDomain -Property Id,IsVerified,IsDefault

This helps you optimize scripts or audits by limiting output to only the fields you need.

Get All Verified Domains in the Tenant

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.


What’s Different with Get-MgDomain?


🔄 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

Conclusion

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.



Permission Required

Example:


                                


                                


                                

© Your Site Name. All Rights Reserved. Design by HTML Codex