Export/Private/New-ApplicationGatewayFrontendPorts.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
function Global:New-ApplicationGatewayFrontendPorts {
    <#
    .SYNOPSIS
    ...
     
    .EXAMPLE
    ...
     
    .PARAMETER xxx
    ...
    #>

    [CmdletBinding()]    
    param
    (
        [switch]
        $IncludeSsl
    )
    process {
        Write-Verbose "Adding Frontend-Configuration..."
        $FrontEndPorts = @{
            PrivateHttp = $null
            PublicHttp  = $null
            PublicHttps = $null
            Collection  = @()
        }
        $FrontEndPorts.PrivateHttp = New-AzApplicationGatewayFrontendPort -Name "FrontendPort_Private8080"  -Port 8080
        $FrontEndPorts.PublicHttp = New-AzApplicationGatewayFrontendPort -Name "FrontendPort_Public80"  -Port 80        
        $FrontEndPorts.Collection += ($FrontEndPorts.PrivateHttp,$FrontEndPorts.PublicHttp)
        if ($IncludeSsl) {
            $FrontEndPorts.PublicHttps = New-AzApplicationGatewayFrontendPort -Name "FrontendPort_Public443"  -Port 443            
            $FrontEndPorts.Collection += ($FrontEndPorts.PublicHttps)
        }        
        $FrontEndPorts
    }
}