Skip to content

Get-MgmtGraphDomainVerificationRecord

MgmtGraph: Retrieves DNS verification records for a Microsoft Graph domain

#Requires -Version 5.1
#Requires -Modules Microsoft.Graph.Identity.DirectoryManagement

[CmdletBinding()]
Param (
    [Parameter(Mandatory = $true, Position = 0)]
    [string]$Identity
)

Process {
    try {
        $records = Get-MgDomainVerificationDnsRecord -DomainId $Identity -ErrorAction Stop
        
        $results = foreach ($r in $records) {
            [PSCustomObject]@{
                DomainName  = $Identity
                RecordType  = $r.RecordType
                Label       = $r.Label
                Text        = $r.Text
                Ttl         = $r.Ttl
                IsVerified  = $r.IsVerified
                Timestamp   = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
            }
        }

        Write-Output $results
    }
    catch {
        throw
    }
}

Specifies the name of the domain to audit.

An interactive directory of PowerShell scripts.