Get-MgDomain

What is Get-MgDomain?

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.


Why Use Get-MgDomain?

This cmdlet is particularly useful for domain management and verification tasks. Administrators use it to:

  • Retrieve all domains registered in the tenant.
  • Identify verified and default domains.
  • Auditauthentication types and domain configurations.
  • Automate domain health and compliance reporting.

By incorporating Get-MgDomain in scripts, admins can efficiently manage multiple domains and ensure smooth user provisioning across verified domains.


Prerequisites

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"

How to Use Get-MgDomain?

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.


Get-MgDomain Examples

Example 1: Retrieve All Domains

This command retrieves all domains registered in your Microsoft 365 tenant.

Get-MgDomain

Example 2: Retrieve a Specific Domain by Domain ID

This command retrieves detailed information about a specific domain using its domain ID.

Get-MgDomain -DomainId "example.com"

Example 3: Retrieve Specific Properties of All Domains

This example selects specific properties to generate a concise domain summary report.

Get-MgDomain -Property Id,IsVerified,IsDefault

Example 4: Get All Verified Domains in the Tenant

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

Summary

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