Private/PartnerMenu/Start-PartnerMenuTenantSelection.ps1

function Start-PartnerMenuTenantSelection() {
    Get-PartnerMenuHeader -SectionString "Select an existing tenant."

    $SearchString = Read-Host "Enter a tenant name or domain name to search for"

    $Tenants = Get-Tenants -SearchString $SearchString

    if($Tenants) {
        $Tenant = $Tenants | Out-GridView -Title "Select a tenant" -PassThru
        $TenantId = $Tenant.CustomerId
    } else {
        Write-Host "No tenants found matching '$($SearchString)'." -ForegroundColor Red
        Read-Host "Press any key to continue..."
        Start-PartnerMenuTenantSelection
    }

    Write-Host "Found $($Tenants.Count) tenants!"


}