Public/Get-Customers.ps1

function Get-Customers {
    [OutputType([Microsoft.Graph.Contract])]
    Param(
        [Parameter()]
        [string]$TenantId,
        [Parameter()]
        [string]$DefaultDomainName
    )
    process {
        Connect-CustomerGraph -CustomerTenantId $PartnerTenantId
        try {
            $Customers = Get-MgContract -All
            if($TenantId) {
                $Customers = $Customers | Where-Object { $_.CustomerId -eq $TenantId }
            } elseif ($DefaultDomainName) {
                $Customers = $Customers | Where-Object { $_.DefaultDomainName -eq $DefaultDomainName }
            }
            $Customers
        }
        catch {
            Write-Error "Failed to retreive customers from MS Graph: $_"
        }
    }
}