The Get-MgDomain cmdlet retrieves domain information configured in a Microsoft 365 tenant. It helps administrators view and manage domain details such as verification status, authentication type, and whether the domain is set as the default domain for the tenant.
This cmdlet is particularly useful for domain management and verification tasks. Administrators use it to:
By incorporating Get-MgDomain in scripts, admins can efficiently manage multiple domains and ensure smooth user provisioning across verified domains.
Before running this cmdlet, ensure you have the Microsoft Graph PowerShell module installed and are connected to Graph with the proper permissions:
Install-Module Microsoft.Graph -Scope CurrentUser
Connect-MgGraph -Scopes "Domain.Read.All"
Use Get-MgDomain to list all domains or retrieve a specific domain using its domain ID.
Get-MgDomain -DomainId <String>
This cmdlet supports filtering and property selection, allowing you to tailor the output for reporting or validation purposes.
This command retrieves all domains registered in your Microsoft 365 tenant.
Get-MgDomain
This command retrieves detailed information about a specific domain using its domain ID.
Get-MgDomain -DomainId "example.com"
This example selects specific properties to generate a concise domain summary report.
Get-MgDomain -Property Id,IsVerified,IsDefault
This command lists all verified domains within your tenant, including their authentication type.
Get-MgDomain -All | Where-Object { $_.isVerified -eq $true } | Select-Object Id, IsVerified, AuthenticationType
| Key Point | Details |
|---|---|
| Cmdlet Name | Get-MgDomain |
| Purpose | Retrieves domain configuration and verification details in Microsoft 365 |
| Required Scope | Domain.Read.All |
| Primary Parameter | DomainId, Property |
| Automation Benefit | Enables automated domain audits and compliance checks |
| Use Case | Domain inventory, verification status reporting, and configuration validation |
Did You Know? Managing Microsoft 365 applications is even easier with automation. Try our Graph PowerShell scripts to automate tasks like generating reports, cleaning up inactive Teams, or assigning licenses efficiently.
Ready to get the most out of Microsoft 365 tools? Explore our free Microsoft 365 administration tools to simplify your administrative tasks and boost productivity.
© Your Site Name. All Rights Reserved. Design by HTML Codex