Skip to content

Confirm-MgmtGraphDomain

MgmtGraph: Confirms Microsoft Graph domain ownership

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

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

Process {
    try {
        $params = @{
            'DomainId'    = $Identity
            'Confirm'     = $false
            'ErrorAction' = 'Stop'
        }

        $domain = Confirm-MgDomain @params
        
        $result = [PSCustomObject]@{
            DomainName = $domain.Id
            IsVerified = $domain.IsVerified
            Action     = "DomainVerificationTriggered"
            Status     = "Success"
            Timestamp  = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
        }

        Write-Output $result
    }
    catch {
        throw
    }
}

Specifies the name of the domain to confirm.

An interactive directory of PowerShell scripts.