Manage M365 DNS Records with PowerShell

Manage M365 DNS Records with PowerShell

Hi All,

I guess all M365 Admins know how to Manage the M365 Domains in Admin Portal

Did you know that you can also manage them via Microsoft.Graph PowerShell Modules? You need to connect with the Scope “Domain.Read.All” or “Domain.ReadWrite.All”

Connect-MgGraph -Scopes Domain.Read.All

Admin consent

List Domains in M365 Tenant

Import-Module Microsoft.Graph.Identity.DirectoryManagement
Get-MgDomain

List Service Configuration DNS Records for a specific Domain

Get-MgDomainServiceConfigurationRecord -DomainId icewolf.ch

List details of the MX Record

$M365DNSRecords = Get-MgDomainServiceConfigurationRecord -DomainId icewolf.ch
$M365DNSRecords | where {$_.RecordType -eq "MX"}
$M365DNSRecords | where {$_.RecordType -eq "MX"} | fl

List all details of Records required for Email Service

$M365DNSRecords | where {$_.SupportedService -eq "Email"} | fl

There are more Commands available for Managing your M365 Domains

Get-Command *MgDomain*

Regards
Andres Bohren

Exchange Logo

PowerShell Logo