Public/PartnerCenter/Get-PartnerCustomer.ps1

function Get-PartnerCustomer {
    [CmdletBinding()]
    param(
        [Parameter()]
        [string]$CustomerTenantId
    )

    try {
        Connect-CustomerGraph -CustomerTenantId $Script:config.PartnerTenantId -FlowType Delegated
        $customers = Get-MgContract -All
        if($CustomerTenantId) {
            return $customers | Where-Object { $_.CustomerId -eq $CustomerTenantId }
        } else {
            return $customers
        }
    }
    catch {
        throw [TokenOperationException]::new(
            'PartnerCenter',
            "Failed to get customer information: $($_.Exception.Message)",
            $_
        )
    }
}