Public/SC_Connectors.ps1

<#
.SYNOPSIS
    Read existing SEPPMAIL.cloud Exchange Online connectors
.DESCRIPTION
    SEPPMAIL.cloud uses 2 Connectors to transfer messages between SEPPMAIL.cloud and Exchange Online
    This commandlet will show existing connectors.
.PARAMETER routing
    Required routing mode: parallel (or p) when MX records point to Microsoft,
    or inline (or i) when MX records point to SEPPMAIL.cloud.
.PARAMETER inBoundOnly
    Return only the inbound connector. Available only in the inline parameter set.
.EXAMPLE
    Get-SC365Connectors -routing parallel
     
    Displays all SEPPMAIL.cloud Connectors configured in parallel mode.
    Shows both Inbound and Outbound Connectors with region and version information.
.EXAMPLE
    Get-SC365Connectors -routing inline
     
    Displays all SEPPMAIL.cloud Connectors configured in inline mode.
    Shows both Inbound and Outbound Connectors with TLS certificate details.
.EXAMPLE
    Get-SC365Connectors -routing inline -InboundOnly
     
    Displays only the Inbound Connector in inline/InboundOnly mode.
    Useful when only inbound mail filtering is configured.
.EXAMPLE
    Get-SC365Connectors -routing parallel | Format-List
     
    Displays detailed connector information in list format.
    Shows all properties including enabled state, IP addresses, and timestamps.
.NOTES
    See https://github.com/seppmail/SEPPMAIL365cloud/blob/main/README.md for more
#>

function Get-SC365Connectors
{
    [CmdletBinding(
        SupportsShouldProcess = $false,
        ConfirmImpact = 'Medium',
        DefaultParameterSetName = 'parallel'
        # HelpURI = 'https://github.com/seppmail/SEPPMAIL365cloud/blob/main/README.md#setup-the-integration'
     )]

    param
    (
        [Parameter(
            Mandatory = $true,
            HelpMessage = '`"inline`": mx points to SEPPMAIL.cloud, `"parallel`": mx points to Microsoft'
            )]
        [ValidateSet('parallel','inline','p','i')]
        [String] $routing,

        [Parameter(
            Mandatory = $false,
            ParameterSetName = 'inline',
            HelpMessage = 'For routing type `"inline`", if only inbound service is used.'
        )]
        [switch]$inBoundOnly
    )

    begin {       
        if (!(Test-SC365ExoConnStatus)) { 
            throw [System.Exception] "You're not connected to Exchange Online - please connect prior to using this CmdLet"
        }
        else {
            Write-Verbose "Connected to Exchange Organization `"$Script:ExODefaultDomain`" " 
        }
        if ($routing -eq 'p') { $routing = 'parallel' }
        if ($routing -eq 'i') { $routing = 'inline' }
    }
    process {
        $inbound = Get-SC365InboundConnectorSettings -Routing $routing
        $ibc = Get-InboundConnector $inbound.Name -WarningAction SilentlyContinue -ErrorAction SilentlyContinue
        if ($ibc | Where-Object Identity -eq $($inbound.Name))
        {
            $ibc | Add-Member -MemberType NoteProperty -Name "SC365ModuleVersion" -Value (Get-SC365moduleVersion $($ibc.comment))
            $ibc | Add-Member -MemberType NoteProperty -Name "Region" -Value (($ibc.TlsSenderCertificateName.Split('.')[1]))
            $ibc.PSObject.TypeNames.Insert(0, "SEPPMAIL.cloud.Connectors")
            $ibc
        }
        else 
        {
            Write-Warning "No SEPPMAIL.cloud Inbound Connector with Name `"$($inbound.Name)`" found - Wrong routing mode ?"
        }
        if ($inBoundOnly -eq $false) {
            $outbound = Get-SC365OutboundConnectorSettings -Routing $routing
            $obc = Get-OutboundConnector $outbound.Name -WarningAction SilentlyContinue -ErrorAction SilentlyContinue
            if ($obc | Where-Object Identity -eq $($outbound.Name)){
                $obc | Add-Member -MemberType NoteProperty -Name 'SC365ModuleVersion' -Value (Get-SC365moduleVersion $($obc.comment))
                $obc | Add-Member -MemberType NoteProperty -Name 'Region' -Value ($obc.TlsDomain.Split('.')[1])
                $obc.PSObject.TypeNames.Insert(0, "SEPPMAIL.cloud.Connectors")
                $obc
            }
            else {
                Write-Warning "No SEPPMAIL.cloud Outbound Connector with name `"$($outbound.Name)`" found - Wrong routing mode or inbound only ?"
            }
        }
    }
}

<#
.SYNOPSIS
    Adds/Renews SEPPMAIL.cloud Exchange Online connectors
.DESCRIPTION
    SEPPMAIL.cloud uses 2 Connectors to transfer messages between SEPPMAIL.cloud and Exchange Online
    This commandlet will create the connectors for you, depending on routing mode and the region.
.PARAMETER SEPPMAILCloudDomain
    Required accepted domain booked for SEPPMAIL.cloud. Used to construct the
    smart host and resolve the tenant ID. Aliases: domain, maildomain, primaryMailDomain.
.PARAMETER region
    Required region of the provisioned cloud service. Accepted values: ch, de, prv, dev.
    Use the region returned by Get-SC365DeploymentInfo.
.PARAMETER routing
    Required routing mode: parallel (p) for MX records pointing to Microsoft,
    or inline (i) for MX records pointing to SEPPMAIL.cloud.
.PARAMETER inBoundOnly
    Create only the inbound connector. Intended for inline inbound-only deployments.
    Without this switch, both inbound and outbound connectors are created.
.PARAMETER disabled
    Create connectors disabled instead of enabling them immediately. This does not
    suppress the other tenant preparation changes performed by this function.
.PARAMETER stayIpv4
    Skip enabling IPv6 for the accepted domain. This does not disable existing IPv6 support.
.PARAMETER force
    Replace existing connectors without the interactive replacement prompt and bypass
    the hybrid-configuration warning prompt. Existing settings can be lost; back them up first.
.PARAMETER aliasRename
    Boolean, default $false. With $false, the function enables SendFromAliasEnabled
    in the organization configuration. Pass -aliasRename $true to leave that setting unchanged.
.PARAMETER NamePrefix
    Prefix to prepend to the standard connector names. The default is no prefix.
    Other cloud cmdlets generally look for standard names; a prefix does not isolate
    the tenant preparation changes or create a fully independent test setup.
.PARAMETER WhatIf
    Preview operations guarded by ShouldProcess. This is NOT a tenant-wide dry run:
    preparation changes (including policy, ARC and IPv6 settings) and some forced
    removals are not guarded. Do not run against production merely to preview a setup.
.PARAMETER Confirm
    Request confirmation for operations guarded by ShouldProcess. -Confirm:$false
    suppresses those prompts, but not custom interactive prompts. Unguarded changes
    are not covered by this parameter.
.EXAMPLE
    New-SC365Connectors -SEPPMAILCloudDomain 'contoso.eu' -region 'ch' -routing 'inline'
     
    Creates Connectors for domain contoso.eu in Switzerland region with inline routing.
    Mail flows through SEPPMAIL.cloud (MX points to SEPPMAIL.cloud).
    Both Inbound and Outbound Connectors are created and enabled immediately.
.EXAMPLE
    New-SC365Connectors -SEPPMAILCloudDomain 'contoso.eu' -region 'ch' -routing 'inline' -disabled
     
    Creates Connectors for domain contoso.eu in Switzerland region with inline routing.
    Connectors are created in disabled state for manual review and activation.
    Useful for testing configuration before enabling mail flow.
.EXAMPLE
    New-SC365Connectors -SEPPMAILCloudDomain 'contoso.eu' -region 'ch' -routing 'inline' -Confirm:$false -Force
     
    Creates Connectors for domain contoso.eu in Switzerland region with inline routing.
    Existing connectors are deleted and recreated without the replacement prompt.
    Use with caution - existing configuration will be overwritten.
.EXAMPLE
    New-SC365Connectors -SEPPMAILCloudDomain 'contoso.eu' -routing 'parallel' -region 'de'
     
    Creates Connectors for domain contoso.eu in Germany/EU region with parallel routing.
    MX records point to Microsoft, mail is routed via Connector to SEPPMAIL.cloud.
    Uses Microsoft's spam filtering before SEPPMAIL.cloud processing.
.EXAMPLE
    New-SC365Connectors -SEPPMAILCloudDomain 'contoso.com' -region 'ch' -routing 'inline' -InboundOnly
     
    Creates only Inbound Connector for domain contoso.com in Switzerland region.
    Outbound mail is not routed via SEPPMAIL.cloud (InboundOnly mode).
    Useful when only inbound encryption/filtering is required.
.EXAMPLE
    New-SC365Connectors -SEPPMAILCloudDomain 'contoso.de' -region 'de' -routing 'parallel' -stayIpv4
     
    Creates Connectors in parallel mode without enabling IPv6.
    Leaves the existing IPv6 setting of the accepted domain unchanged.
    Use when IPv6 support is not required or desired.
.EXAMPLE
    New-SC365Connectors -SEPPMAILCloudDomain 'contoso.ch' -region 'ch' -routing 'inline' -NamePrefix 'TEST-'
     
    Creates Connectors with custom name prefix 'TEST-'.
    Existing standard-named connectors are retained, but tenant-wide preparation settings can still change.
    Results in connector names like 'TEST-[SEPPMAIL.cloud] Inbound-inline'.
.EXAMPLE
    New-SC365Connectors -SEPPMAILCloudDomain 'contoso.eu' -region de -routing parallel -aliasRename $true
 
    Creates connectors while leaving SendFromAliasEnabled unchanged.
    This Boolean parameter requires an explicit value; it is not a switch.
.EXAMPLE
    New-SC365Connectors -SEPPMAILCloudDomain 'contoso.eu' -region de -routing parallel -WhatIf
 
    Shows guarded connector operations, but can still modify tenant preparation settings.
    Use only in a disposable test tenant; this is not a safe production dry run.
.EXAMPLE
    New-SC365Connectors -SEPPMAILCloudDomain 'contoso.eu' -region de -routing parallel -Confirm
 
    Requests confirmation for guarded connector operations.
    Preparation changes are not all guarded and can occur before a confirmation prompt.
.INPUTS
     
.OUTPUTS
    Inbound and OutboundConnectors
.NOTES
    See https://github.com/seppmail/SEPPMAIL365cloud/blob/main/README.md for more
#>

function New-SC365Connectors
{
    [CmdletBinding(
         SupportsShouldProcess = $true,
         ConfirmImpact = 'Medium',
         DefaultParameterSetName = 'BothDirections'
         # HelpURI = 'https://github.com/seppmail/SEPPMAIL365cloud/blob/main/README.md#setup-the-integration'
     )]
    param
    (
        [Parameter(
            Mandatory = $true,
            ParameterSetName = 'Bothdirections',
            HelpMessage = 'Default E-Mail domain of your Exchange Online tenant.'
            )]
        [Parameter(
            Mandatory = $true,
            ParameterSetName = 'InBoundOnly',
            HelpMessage = 'Default E-Mail domain of your Exchange Online tenant.'
            )]
        [Alias('domain','maildomain','primaryMailDomain')]
        [String] $SEPPMAILCloudDomain,

        [Parameter(
            Mandatory = $true,
            ParameterSetName = 'BothDirections',
            HelpMessage = 'Geographical region of the seppmail.cloud service, either "ch" or "de"'
        )]
        [Parameter(
            Mandatory = $true,
            ParameterSetName = 'InBoundOnly',
            HelpMessage = 'Geographical region of the seppmail.cloud service, either "ch" or "de"'
        )]
        [ValidateSet('ch','prv','de','dev')]
        [String]$region,

        [Parameter(
            Mandatory = $true,
            ParameterSetName = 'BothDirections',
            HelpMessage = '`"seppmailcloud`": mx points to SEPPMAIL.cloud, `"parallel`": mx points to Microsoft'
            )]
        [Parameter(
            Mandatory = $true,
            ParameterSetName = 'InBoundOnly',
            HelpMessage = '`"inline`": mx points to SEPPMAIL.cloud, `"parallel`": mx points to Microsoft'
            )]
        [ValidateSet('parallel','inline','p','i')]
        [String] $routing,

        [Parameter(
            Mandatory = $false,
            ParameterSetName = 'InBoundOnly',
            HelpMessage = 'For routingtype `"inline`", if only inbound service is used.'
        )]
        [switch]$inBoundOnly,

        [Parameter(
            Mandatory = $false,
            ParameterSetName = 'BothDirections',
            HelpMessage = 'Disable the connectors on creation'
        )]
        [Parameter(
            Mandatory = $false,
            ParameterSetName = 'InBoundOnly',
            HelpMessage = 'Disable the connectors on creation'
        )]
        [switch]$disabled,

        [Parameter(
            Mandatory = $false,
            ParameterSetName = 'BothDirections',
            HelpMessage = 'Disable ipv6 enabling during connector creation'
        )]
        [Parameter(
            Mandatory = $false,
            ParameterSetName = 'InBoundOnly',
            HelpMessage = 'Disable ipv6 enabling during connector creation'
        )]
        [switch]$stayIpv4,

        [Parameter(
            Mandatory = $false,
            ParameterSetName = 'BothDirections',
            HelpMessage = 'Force overwrite of existing connectors and ignore hybrid setup'
        )]
        [Parameter(
            Mandatory = $false,
            ParameterSetName = 'InBoundOnly',
            HelpMessage = 'Force overwrite of existing connectors and ignore hybrid setup'
        )]
        [switch]$force,

        [Parameter(
            Mandatory = $false,
            ParameterSetName = 'BothDirections',
            HelpMessage = 'Force overwrite of existing connectors and ignore hybrid setup'
        )]
        [Parameter(
            Mandatory = $false,
            ParameterSetName = 'InBoundOnly',
            HelpMessage = 'Force overwrite of existing connectors and ignore hybrid setup'
        )]
        [bool]$aliasRename = $false,

        [Parameter(
            Mandatory = $false,
            ParameterSetName = 'BothDirections',
            HelpMessage = 'Use custom name instead of name from cloud config'
        )]
        [Parameter(
            Mandatory = $false,
            ParameterSetName = 'InBoundOnly',
            HelpMessage = 'Use custom name instead of name from cloud config'
        )]
        [String]$NamePrefix

    )

    begin
    {        
        if(!(Test-SC365ExoConnStatus)) {
            throw [System.Exception] "You're not connected to Exchange Online - please connect prior to using this CmdLet"
        } else {
            Write-Verbose "Connected to Exchange Organization `"$Script:ExODefaultDomain`"" -InformationAction Continue
        }
 
        if ($routing -eq 'p') {$routing = 'parallel'}
        if ($routing -eq 'i') {$routing = 'inline'}
        
        # Add Warning for INLINE Connectors
        if ($routing -eq 'inline') {
            Write-Warning "You are about to create a SEPPMAIL INLINE Setup which will affect ALL Domains of your Microsoft Tenant."
        }

        if ($SEPPMAILCloudDomain) {
            if ((Confirm-SC365TenantDefaultDomain -ValidationDomain $SEPPMAILCloudDomain) -eq $true) {
                Write-verbose "Domain is part of the tenant and the Default Domain"
            } else {
                if ((Confirm-SC365TenantDefaultDomain -ValidationDomain $SEPPMAILCloudDomain) -eq $false) {
                    Write-verbose "Domain is part of the tenant"
                } else {
                    Write-Error "Domain is NOT Part of the tenant"
                    break
                }
            }
            Write-Verbose "Adding SEPPMAIL Support-Addresses to allowedSenders in HostedContentFilterPolicy"
            [string[]]$existingAllowedSenders = (Get-HostedContentFilterPolicy -Identity 'Default'|select-Object AllowedSenders).Allowedsenders.Sender|Select-Object -ExpandProperty Address
            [string[]]$SEPPMAILAllowedSenders = @('support@seppmail.de','support@seppmail.com','support@seppmail.ch','servicedesk@seppmail.com')
            $allowedSenders = ($existingAllowedSenders + $SEPPMAILAllowedSenders |Select-Object -Unique)

            Set-HostedContentFilterPolicy -Identity "Default" -AllowedSenders $allowedSenders
        } else {
            $SEPPMAILCloudDomain = $tenantAcceptedDomains|Where-Object {$_.Default -eq $true}
        }

        #region Preparing common setup
        Write-Debug "Preparing values for Cloud configuration"

        Write-debug "Prepare smarthosts for e-Mail domain $SEPPMAILCloudDomain"
        if ($routing -eq 'inline') {
            $OutboundSmartHost = ($SEPPMAILCloudDomain.Replace('.','-')) + '.relay.seppmail.cloud'
        }
        if ($routing -eq 'parallel') {
            $OutboundSmartHost = ($SEPPMAILCloudDomain.Replace('.','-')) + '.mail.seppmail.cloud'
        }
        Write-Verbose "Outbound SmartHost is: $OutboundSmartHost"

        Write-Debug "Prepare GeoRegion configuration for region: $region"
        $regionConfig = (Get-SC365CloudConfig -Region $region)
        $SEPPMAILIPv4Range = $regionConfig.IPv4AllowList
        
        if ($SEPPMAILCloudDomain) {
            $TenantID = Get-SC365Tenantid -Maildomain $SEPPMAILCloudDomain
        } else {
            $TenantID = Get-SC365Tenantid -maildomain ((Get-OrganizationConfig).Identity)
        }
        
        $TlsCertificateName = $regionConfig.TlsCertificate
        Write-Verbose "TLS Certificate is $TlsCertificateName"

        $TenantIdCertificateName = $tenantId + ($regionConfig.TlsCertificate).Replace('*','')
        Write-verbose "Tenant certificate Name is $TenantIdCertificateName"

        Write-Debug "Set timestamp and Moduleversion for Comments"
        $Now = Get-Date
        $moduleVersion = $myInvocation.MyCommand.Version
        #endregion commonsetup

        #region collecting existing connectors and test for hybrid Setup
        Write-Debug "Collecting existing connectors"
        $allInboundConnectors = Get-InboundConnector
        $allOutboundConnectors = Get-OutboundConnector -WarningAction SilentlyContinue

        Write-Verbose "Testing for hybrid Setup"
        $HybridInboundConn = $allInboundConnectors |Where-Object {(($_.Name -clike 'Inbound from *') -or ($_.ConnectorSource -clike 'HybridWizard'))}
        $HybridOutBoundConn = $allOutboundConnectors |Where-Object {(($_.Name -clike 'Outbound to *') -or ($_.ConnectorSource -clike 'HybridWizard'))}
        
        if (($HybridInboundConn -or $HybridOutBoundConn) -and (!($force)))
        {
            Write-Warning "!!! - Hybrid Configuration detected - we assume you know what you are doing. Be sure to backup your connector settings before making any change."
            if($InteractiveSession)
            {
                Write-Verbose "Ask user to continue if Hybrid is found."
                Do {
                    try {
                        [ValidateSet('y', 'Y', 'n', 'N')]$hybridContinue = Read-Host -Prompt "Create SEPPMAIL connectors in hybrid environment ? (Y/N)"
                    }
                    catch {
                    }
                }
                until ($?)
                if ($hybridContinue -eq 'n') {
                    Write-Verbose "Exiting due to user decision."
                    break
                }
            }
            else
            {
                # should we error out here, since connector creation might be dangerous?
            }
        } else {
            Write-Verbose "No Hybrid Connectors detected, seems to be a clean cloud-only environment" -InformationAction Continue
        }

        Write-Debug "Checking for existing SEPPMAIL.cloud rules"
        $existingSC365Rules = Get-TransportRule |Where-Object {($_.RouteMessageOutboundConnector -like '*SEPPMAIL.cloud*') -and ($_.Name -like '*SEPPMAIL.cloud*')} -ea 0
        #endregion collecting existing connectors and test for hybrid Setup

        Write-Debug "Look for ARC-Signature for SEPPMAIL.cloud and add if missing"
        try {
            [string]$ath = (Get-ArcConfig).ArcTrustedSealers
            if ($ath) {
                if ((!($ath.Contains('SEPPMAIL.cloud')))) {
                    Write-Verbose "ARC header `'$ath`' exists, but does not contain SEPPMAIL.cloud"
                    $athNew = $ath.Split(',') + 'SEPPMAIL.cloud'
                    Set-ArcConfig -Identity default -ArcTrustedSealers $athNew|Out-Null
                }
            }
            if (!($ath)) {
                Write-Verbose "ARC header is empty, adding SEPPMAIL.cloud"
                Set-ArcConfig -Identity default -ArcTrustedSealers 'SEPPMAIL.cloud'|Out-Null
            }
            if (($ath.Contains('SEPPMAIL.cloud'))) {
                Write-Verbose "ARC header `'$ath`' exists and contains SEPPMAIL.cloud, no action required"
            }
        } catch {
            throw [System.Exception] "Error: $($_.Exception.Message)"
        }
        if (!($stayIpv4)) {
            Write-Verbose "Enable IPv6 for accepted Domain $SEPPMAILCloudDomain if disabled"
            Write-Progress -Id 1 -Activity 'IPv6-Konfiguration' -Status "Check Status for $SEPPMAILCloudDomain..." -PercentComplete 10
            $ipv6Status = (Get-IPv6StatusForAcceptedDomain -Domain $SEPPMAILCloudDomain -ErrorAction SilentlyContinue).Status
            if ($ipv6Status -eq 'Disabled') {
                Write-Progress -Id 1 -Activity 'IPv6-Configuration' -Status "Activate IPv6 for $SEPPMAILCloudDomain..." -PercentComplete 60
                Enable-IPv6ForAcceptedDomain -Domain $SEPPMAILCloudDomain -ErrorAction SilentlyContinue
                Write-Progress -Id 1 -Activity 'IPv6-Configuration' -Status 'IPv6 activated' -PercentComplete 100 -Completed
            }
            else {
                Write-Progress -Id 1 -Activity 'IPv6-Configuration' -Status 'IPv6 already activated' -PercentComplete 100 -Completed
            }
        }
    }

    process
    {
            #region - OutboundConnector
            Write-Debug "Building Outbound parameters based on smarthost $outboundtlsdomain"
            $param = Get-SC365OutboundConnectorSettings -Routing $routing -Option $option
            $param.SmartHosts = $OutboundSmartHost
            Write-Verbose "Outbound Connector Smarthosts are $($param.SmartHosts)"
            $param.TlsDomain = $TlsCertificateName
            Write-Verbose "Outbound Connector TLS certificate name is $($param.TlsDomain)"
            
            Write-verbose "if -disabled switch is used, the connector stays deactivated"
            if ($Disabled) {
                $param.Enabled = $false
            }

            Write-Debug "Read existing SEPPMAIL.cloud outbound connector"
            $existingSMOutboundConn = $allOutboundConnectors | Where-Object Name -eq $param.Name
            # only $false if the user says so interactively

            [bool]$createOutBound = $true #Set Default Value
            #wait-debugger
            if (($existingSMOutboundConn) -and ((!$NamePrefix)))
            {
                if ($existingSC365Rules.Count -ge 1) {

                    Write-Warning "Found existing SEPPMAIL.cloud outbound connector with name: `"$($existingSMOutboundConn.Name)`" created on `"$($existingSMOutboundConn.WhenCreated)`" pointing to SEPPMAIL `"$($existingSMOutboundConn.TlsDomain)`" "
                    if (($InteractiveSession) -and (!($force)))
                    {
                        [string] $tmp = $null

                        Do {
                            try {
                                [ValidateSet('y', 'Y', 'n', 'N')]$tmp = Read-Host -Prompt "Shall we delete and recreate the outbound connector (will only work if no rules use it)? (Y/N)"
                                break
                            }
                            catch {}
                        }
                        until ($?)

                        if ($tmp -eq 'y') {
                            $createOutbound = $true

                            Write-Verbose "Removing existing Outbound Connector $($existingSMOutboundConn.Name) !"
                            if ($PSCmdLet.ShouldProcess($($existingSMOutboundConn.Name), 'Removing existing SEPPMAIL.cloud Outbound Connector')) {
                                Remove-OutboundConnector -Identity $($ExistingSMOutboundConn.Identity) -Confirm:$false # user confirmation action

                                if (!$?)
                                { throw $error[0] }
                            }
                        }
                        else {
                            Write-Warning "Leaving existing SEPPMAIL outbound connector `"$($existingSMOutboundConn.Name)`" untouched."
                            $createOutbound = $false
                        }
                    }
                    else
                    {
                        if (!($force)) {
                            throw [System.Exception] "Outbound connector $($outbound.Name) already exists"
                        }
                        else {
                            Write-Verbose "Removing existing OutBound Connector $existingSMOutboundConn.Identity due to -force parameter"
                            try {
                                $existingSMOutboundConn | Remove-OutboundConnector -Confirm:$false # due to -force
                            }
                            catch {
                                # Errormessage
                                $error[0]
                            }
                        }
                    }
                }
                else {
                    Write-Error "There are still transport-rules pointing to the outbound Connector $($existingSMOutboundConn.Identity). `nRules are: $existingSc365Rules. `nUse `"Remove-SC365rules -routing parallel/inline`" to remove and restart New-SC365Connectors."
                }
            }
            else
            { Write-Verbose "No existing Outbound Connector found" }

            if($createOutbound -and (!($inBoundOnly)))
            {
                Write-Debug "Creating SEPPMAIL.cloud Outbound Connector $($param.Name)!"
                if ($PSCmdLet.ShouldProcess($($param.Name), 'Creating Outbound Connector'))
                {

                    $param.Comment += "`nCreated with SEPPMAIL365cloud PowerShell Module version $moduleVersion on $now"
                    if ($NamePrefix) {
                        $Param.Name = "$NamePrefix" + "$($Param.Name)"
                    }                    
                    New-OutboundConnector @param | Select-Object Identity,Enabled,WhenCreated,@{Name = 'Region'; Expression = {($_.TlsDomain.Split('.')[1])}}

                    if(!$?)
                    {throw $error[0]}
                }
            }
            #endregion - OutboundConnector

            #region - InboundConnector
            Write-Debug "Read Inbound Connector Settings"
            $param = $null
            $param = Get-SC365InboundConnectorSettings -routing $routing -option $option
        
            Write-verbose "if -disabled switch is used, the connector stays deactivated"
            if ($disabled) {
                $param.Enabled = $false
            }

            Write-Verbose "Read existing SEPPMAIL Inbound Connector from Exchange Online"
            $existingSMInboundConn = $allInboundConnectors | Where-Object Name -EQ $param.Name

            # only $false if the user says so interactively
            [bool]$createInbound = $true
            if (($existingSMInboundConn) -and ((!$NamePrefix)))
            {
                Write-Warning "Found existing SEPPMAIL.cloud inbound connector with name: `"$($existingSMInboundConn.Name)`", created `"$($existingSMInboundConn.WhenCreated)`" incoming SEPPMAIL is `"$($existingSMInboundConn.TlsSenderCertificateName)`""

                if (($InteractiveSession) -and (!($force)))
                {
                    [string] $tmp = $null
                    Do {
                        try {
                            [ValidateSet('y', 'Y', 'n', 'N')]$tmp = Read-Host -Prompt "Shall we delete and recreate the inbound connector (will only work if no rules use it)? (Y/N)"
                            break
                        }
                        catch {}
                    }
                    until ($?)

                    if ($tmp -eq 'y') {
                        $createInbound = $true

                        Write-Verbose "Removing existing SEPPMAIL.cloud Inbound Connector $($existingSMInboundConn.Name) !"
                        if ($PSCmdLet.ShouldProcess($($existingSMInboundConn.Name), 'Removing existing SEPPMAIL.cloud inbound Connector')) {
                            $existingSMInboundConn | Remove-InboundConnector -Confirm:$false # user already confirmed action

                            if (!$?)
                            { throw $error[0] }
                        }
                    }
                    else {
                        Write-Warning "Leaving existing SEPPMAIL.cloud Inbound Connector `"$($existingSMInboundConn.Name)`" untouched."
                        $createInbound = $false
                    }
                }
                else
                {
                    if (!($force)) {
                        throw [System.Exception] "Inbound connector $($param.Name) already exists"
                    }
                    else {
                        $existingSMInboundConn | Remove-InboundConnector -Confirm:$false # due to -force
                    }
                
                }
            }
            else
            {Write-Verbose "No existing Inbound Connector found"}

            if($createInbound)
            {
                Write-Verbose "Setting $TlscertificateName as TLSSendercertificate and IP addresses to region $region"
                if ($routing -eq 'parallel') {$param.RestrictDomainsToIPAddresses = $false}
                #60 if ($routing -eq 'parallel') {$param.SenderIPAddresses = $SEPPMAILIPv4Range}
                if ($routing -eq 'inline') {$param.SenderDomains = 'smtp:' + '*' + ';1'} # smtp:*;1
                
                # Inline and parallel use same certificate
                $param.TlsSenderCertificateName = $TenantIdCertificateName
                Write-verbose "Inbound TlsSenderCertificateName is: $param.TLSSenderCertificatename"
                
                #region Create Inbound Connector
                Write-Verbose "Creating SEPPMAIL.cloud Inbound Connector $($param.Name)!"
                if ($PSCmdLet.ShouldProcess($($param.Name), 'Creating Inbound Connector'))
                {

                    $param.Comment += "`nCreated with SEPPMAIL365cloud PowerShell Module version $moduleVersion on $now"
                    Write-Verbose "Check if parameter `$name was set and overwrite"
                    if ($namePrefix) {
                        $Param.Name = "$NamePrefix" + "$($Param.Name)"
                    }
                    if ($aliasRename -eq $false) {
                        Write-Verbose "Enabling SendFromAlias in OrganizationConfig due to -aliasRename switch"
                        if ((Get-OrganizationConfig).SendFromAliasesEnabled -eq $false) {
                            Write-Verbose "SendFromAliases is enabled in OrganizationConfig, enabling also for Inbound Connector"
                            Set-OrganizationConfig -SendFromAliasEnabled $true
                        }                    
                    }
                    New-InboundConnector @param |Select-Object Identity,Enabled,WhenCreated,@{Name = 'Region'; Expression = {($_.TlsSenderCertificateName.Split('.')[1])}}

                    if(!$?) {
                        throw $error[0]
                    } else {
                        #region - Add Region-based IP-range to hosted Connection Filter Policy AllowList
                        if ($option -eq 'AntiSpamAllowListing')
                        {
                            Write-Verbose "Adding SEPPMAIL.cloud to AllowList in 'Hosted Connection Filter Policy'"
                            Write-Verbose "Collecting existing AllowList"
                            $hcfp = Get-HostedConnectionFilterPolicy
                            [string[]]$existingAllowList = $hcfp.IPAllowList
                            Write-verbose "Adding SEPPMAIL.cloud IP ranges to HostedConnectionFilterPolicy $($hcfp.Id)"
                            if ($existingAllowList) {
                                $FinalIPList = ($existingAllowList + $SEPPMAILIPv4Range)|sort-object -Unique
                            }
                            else {
                                $FinalIPList = $SEPPMAILIPv4Range
                            }
                            Write-verbose "Adding IPaddress list with content $finalIPList to hosted connection filter policy $($hcfp.Id)"
                            if ($FinalIPList) {
                                [void](Set-HostedConnectionFilterPolicy -Identity $hcfp.Id -IPAllowList $finalIPList)
                            }
                        }
                        #endRegion - Hosted Connection Filter Policy AllowList
                    }
                }
                #endregion Create Inbound Connector
            }
            #endRegion - InboundConnector
    }
    end
    {

    }
}

<#
.SYNOPSIS
    Removes the SEPPMAIL inbound and outbound connectors
.DESCRIPTION
    Convenience function to remove the SEPPMAIL connectors
.PARAMETER routing
    Required routing mode: parallel (p) or inline (i). Select the mode whose standard
    connector names should be removed. Remove dependent transport rules first.
.PARAMETER inBoundOnly
    Remove only the inbound connector, leaving the outbound connector unchanged.
    This switch is mandatory in the inline parameter set. To remove both inline
    connectors without an interactive parameter prompt, pass -inBoundOnly:$false.
.PARAMETER option
    Optional value AntiSpamAllowListing preserves the connection filter IP allow list.
    If omitted, the function attempts to remove IP addresses collected from the
    deleted inbound connector from that allow list.
.PARAMETER WhatIf
    Preview connector removals without performing them. Exchange Online connection
    checks and configuration reads still run.
.PARAMETER Confirm
    Request confirmation for each guarded connector removal.
    -Confirm:$false suppresses these confirmations.
.EXAMPLE
    Remove-SC365Connectors -routing parallel
     
    Removes all SEPPMAIL.cloud Connectors configured in parallel mode.
    Removes both Inbound and Outbound Connectors from Exchange Online.
    Also removes SEPPMAIL.cloud IP addresses from the Hosted Connection Filter Policy.
.EXAMPLE
    Remove-SC365Connectors -routing inline -inBoundOnly:$false
     
    Removes all SEPPMAIL.cloud Connectors configured in inline mode.
    Removes both Inbound and Outbound Connectors.
    Remember to update MX records to point back to Microsoft after removal.
.EXAMPLE
    Remove-SC365Connectors -routing inline -InboundOnly
     
    Removes only the Inbound Connector in inline mode.
    Useful when only inbound filtering was configured.
    Outbound Connector (if any) remains untouched.
.EXAMPLE
    Remove-SC365Connectors -routing parallel -WhatIf
     
    Shows what would be removed without actually deleting anything.
    Displays which connectors would be affected.
    Useful for verification before actual removal.
.EXAMPLE
    Remove-SC365Connectors -routing parallel -Confirm:$false
     
    Removes all parallel mode connectors without confirmation prompts.
    Use with caution - connectors will be deleted immediately.
    Suitable for automation scripts.
.EXAMPLE
    Remove-SC365Connectors -routing parallel -option AntiSpamAllowListing
 
    Removes the connectors while preserving the existing connection filter IP allow list.
.EXAMPLE
    Remove-SC365Connectors -routing parallel -Confirm
 
    Asks for confirmation before removing each connector. Review rule dependencies first.
.NOTES
    See https://github.com/seppmail/SEPPMAIL365cloud/blob/main/README.md for more
#>

function Remove-SC365Connectors
{
    [CmdletBinding(
        SupportsShouldProcess = $true,
        ConfirmImpact = 'Medium',
        DefaultparameterSetname = 'parallel'
        # HelpURI = 'https://github.com/seppmail/SEPPMAIL365cloud/blob/main/README.md#setup-the-integration'
     )]

    param
    (
        [Parameter(
            Mandatory = $true,
            ParameterSetname = 'parallel',
            Helpmessage = '`"seppmailcloud`": mx points to SEPPMAIL.cloud, `"parallel`": mx points to Microsoft'
            )]
        [Parameter(
            Mandatory = $true,
            ParameterSetname = 'inline',
            Helpmessage = '`"inline`": mx points to SEPPMAIL.cloud, `"parallel`": mx points to Microsoft'
            )]
        [ValidateSet('parallel','inline','p','i')]
        [String] $routing,

        [Parameter(
            Mandatory = $true,
            ParameterSetName = 'inline',
            HelpMessage = 'For routingtype `"inline`", if only inbound service is used.'
        )]
        [switch]$inBoundOnly,
           
        [Parameter(
            Mandatory = $false,
            ParameterSetname = 'parallel',
            Helpmessage = '`Sets AntiSpam IP AllowList'
            )]
        [Parameter(
            Mandatory = $false,
            ParameterSetname = 'inline',
            Helpmessage = '`Sets AntiSpam IP AllowList'
            )]
        [ValidateSet('AntiSpamAllowListing')]
        [String]$option = $null
    )

    begin {
        if (!(Test-SC365ExoConnStatus)){ 
            throw [System.Exception] "You're not connected to Exchange Online - please connect prior to using this CmdLet" 
        } else {
            Write-Verbose "Connected to Exchange Organization `"$Script:ExODefaultDomain`" " 
        }
        if ($routing -eq 'p') {$routing = 'parallel'}
        if ($routing -eq 'i') {$routing = 'inline'}
    }
    process {
        $inbound = Get-SC365InboundConnectorSettings -routing $routing 
        if (!($inboundOnly)) {$outbound = Get-SC365OutboundConnectorSettings -routing $routing}
        $hcfp = Get-HostedConnectionFilterPolicy
    
        if (!($InBoundOnly)) {
            if ($PSCmdlet.ShouldProcess($outbound.Name, "Remove SEPPMAIL outbound connector $($Outbound.Name)"))
            {
                if (Get-OutboundConnector -WarningAction SilentlyContinue | Where-Object {$_.Name -eq $($outbound.Name)})
                {
                    Remove-OutboundConnector $outbound.Name -confirm:$false
                }
                else {
                    Write-Warning 'No SEPPMAIL Outbound Connector found'
                }
            }    
        }
    
        if($PSCmdlet.ShouldProcess($inbound.Name, "Remove SEPPMAIL inbound connector $($inbound.Name)")) {
            $InboundConnector = Get-InboundConnector | Where-Object {$_.Name -eq $($inbound.Name)}
            if ($inboundConnector)
                {
                Write-Verbose 'Collect Inbound Connector IP for later AllowListremoval'
                
                [string]$InboundSEPPMAILIP = $null
                if ($inboundConnector.TlsSenderCertificateName) {
                    [array]$InboundSEPPMAILIP = $inboundConnector.SenderIPAddresses -split ' '
                }
                Remove-InboundConnector $inbound.Name -confirm:$false

                Write-Verbose "If Inbound Connector has been removed, remove also AllowListed IPs"
                if ((!($Option -like 'AntiSpamAllowListing')) -and (!(Get-InboundConnector | Where-Object Identity -eq $($inbound.Name))))
                {
                    Write-Verbose "Remove SEPPMAIL Appliance IP from AllowList in 'Hosted Connection Filter Policy'"
                    
                    Write-Verbose "Collecting existing AllowList"
                    [System.Collections.ArrayList]$existingAllowList = $hcfp.IPAllowList
                    Write-verbose "Removing SEPPMAIL Appliance IP $InboundSEPPMAILIP from Policy $($hcfp.Id)"
                    if ($existingAllowList) {
                        foreach ($IP in $InboundSEPPMAILIP) {
                            $existingAllowList.Remove($IP)
                        }
                        Set-HostedConnectionFilterPolicy -Identity $hcfp.Id -IPAllowList $existingAllowList
                        Write-Verbose "IP: $InboundSEPPMAILIP removed from Hosted Connection Filter Policy $hcfp.Id"
                    }
                }
                #}
            }
            else 
            {
                Write-Warning 'No SEPPMAIL.Cloud Inbound Connector found'
            }
    
        }
    }
}

if (!(Get-Alias 'Set-SC365Connectors' -ErrorAction SilentlyContinue)) {
    New-Alias -Name Set-SC365Connectors -Value New-SC365Connectors
}

Register-ArgumentCompleter -CommandName New-SC365Connectors -ParameterName SEPPMAILCloudDomain -ScriptBlock $paramDomSB


# SIG # Begin signature block
# MIIQVQYJKoZIhvcNAQcCoIIQRjCCEEICAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCAKpgwmTc3lZxGE
# 0TFfG3/oRmXKGqpsfAkFbqlvSrtifKCCDJEwggYaMIIEAqADAgECAhBiHW0MUgGe
# O5B5FSCJIRwKMA0GCSqGSIb3DQEBDAUAMFYxCzAJBgNVBAYTAkdCMRgwFgYDVQQK
# Ew9TZWN0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