Private/PartnerMenu/Start-PartnerMenuTenantSelection.ps1

function Start-PartnerMenuTenantSelection() {
    param(
        [Parameter()]
        $Tenant
    )

    if(!$Tenant) {
        Get-PartnerMenuHeader -SectionString "Preparing tenant selection..."

        $Tenant = Get-Tenants | Out-ConsoleGridView -Title "Select a tenant" -OutputMode Single
    }
    Clear-Host

    Get-PartnerMenuHeader -SectionString "($($Tenant.displayName)) - Tenant options"

    Write-Host "[1] Connect to Exchange Online environment."
    Write-Host "[2] Connect to Microsoft Graph environment."
    Write-Host "[3] Set mailbox language/region."
    Write-Host "[4] Set calendar permissions."
    Write-Host "[5] Disable Security Defaults."
    Write-Host "[6] Create spamfilter.io Exchange Connector."
    Write-Host "[7] Create BitTitan app registration."
    Write-Host "[8] Back."
    Write-Host ""
    $SelectedOption = Read-Host "Please select an option [1-8] "

    switch ($SelectedOption) {
        "1" {
            Connect-CustomerExchange -CustomerTenantId $Tenant.CustomerId
        }
        "2" {
            Connect-CustomerGraph -CustomerTenantId $Tenant.CustomerId
        }
        "3" {
            Connect-CustomerExchange -CustomerTenantId $Tenant.CustomerId
            $Mailboxes = Get-EXOMailbox -ResultSize Unlimited | Where-Object { $_.Name -notlike 'Discovery*'} | Out-ConsoleGridView -Title "Select the mailboxes to set language/region for" -OutputMode Multiple
            if(($LanguageRegion = Read-Host "Which language/region do you want to set? [da-dk]") -eq ''){$LanguageRegion = "da-dk"}
            foreach ($Mailbox in $Mailboxes) {
                Write-Host "Setting language/region to $($LanguageRegion) for $($Mailbox.UserPrincipalName)..." -ForegroundColor Cyan
                Set-MailboxRegionalConfiguration -Identity $Mailbox -Language $LanguageRegion -LocalizeDefaultFolderName
            }
            Write-Host "Completed setting language/region to $($LanguageRegion) for $($Mailboxes.Count) mailboxes." -ForegroundColor Green
            Read-Host "Press any key to continue.."
            Start-PartnerMenuTenantSelection -Tenant $Tenant
         }
        "4" {
            Connect-CustomerExchange -CustomerTenantId $Tenant.CustomerId
            $Mailboxes = Get-EXOMailbox -ResultSize Unlimited | Where-Object { $_.Name -notlike 'Discovery*'} | Out-ConsoleGridView -Title "Select the mailboxes to set calendar permissions for" -OutputMode Multiple
            if(($CalendarPermission = Read-Host "Which calendar permission do you want to set? [Reviewer]") -eq ''){$LanguageRegion = "Reviewer"}
            foreach ($Mailbox in $Mailboxes) {
                $CalendarFolder = Get-EXOMailboxFolderStatistics -Identity $Mailbox -Folderscope Calendar | Select-Object -First 1
                Write-Host "Setting calendar permission to $($CalendarPermission) for $($Mailbox.UserPrincipalName)..." -ForegroundColor Cyan
                Set-MailboxFolderPermission -Identity "$($Mailbox.UserPrincipalName):\$($CalendarFolder.Name)" -User Default -AccessRights $CalendarPermission
            }
            Write-Host "Completed setting calendar permission to $($CalendarPermission) for $($Mailboxes.Count) mailboxes." -ForegroundColor Green
            Read-Host "Press any key to continue.."
            Start-PartnerMenuTenantSelection -Tenant $Tenant
        }
        "5" {
            Disable-SecurityDefaults -TenantId $Tenant.CustomerId
            Read-Host "Press any key to continue.."
            Start-PartnerMenuTenantSelection -Tenant $Tenant
         }
         "6" {
            New-SpamfilterConnector -TenantId $Tenant.CustomerId
            Read-Host "Press any key to continue.."
            Start-PartnerMenuTenantSelection -Tenant $Tenant
         }
        "7" {
            New-BitTitanAppRegistration -TenantId $Tenant.CustomerId
            Read-Host "Press any key to continue.."
            Start-PartnerMenuTenantSelection -Tenant $Tenant

        }
        "8" { Start-PartnerMenu }
        Default { Start-PartnerMenu }
    }

}