Skip to content

Commit 47e14a5

Browse files
authored
Merge pull request #7121 from akshaysngupta/network-september-release
#Network New cmdlets for Trusted Root Certificate and Autoscale Configuration for Application Gateway
2 parents 9f77587 + b8aa9d6 commit 47e14a5

File tree

51 files changed

+7446
-3348
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+7446
-3348
lines changed

src/ResourceManager/Network/Commands.Network.Test/ScenarioTests/ApplicationGatewayTests.ps1

Lines changed: 50 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,7 @@ function Test-ApplicationGatewayCRUD3
513513
$listener01Name = Get-ResourceName
514514

515515
$poolName = Get-ResourceName
516+
$trustedRootCertName = Get-ResourceName
516517
$poolSetting01Name = Get-ResourceName
517518

518519
$rule01Name = Get-ResourceName
@@ -540,36 +541,76 @@ function Test-ApplicationGatewayCRUD3
540541
$listener01 = New-AzureRmApplicationGatewayHttpListener -Name $listener01Name -Protocol Http -FrontendIPConfiguration $fipconfig -FrontendPort $fp01
541542

542543
# backend part
544+
# trusted root cert part
545+
$certFilePath = $basedir + "/ScenarioTests/Data/ApplicationGatewayAuthCert.cer"
546+
$trustedRoot01 = New-AzureRmApplicationGatewayTrustedRootCertificate -Name $trustedRootCertName -CertificateFile $certFilePath
543547
$pool = New-AzureRmApplicationGatewayBackendAddressPool -Name $poolName -BackendIPAddresses www.microsoft.com, www.bing.com
544-
$probeHttp = New-AzureRmApplicationGatewayProbeConfig -Name $probeHttpName -Protocol Http -HostName "probe.com" -Path "/path/path.htm" -Interval 89 -Timeout 88 -UnhealthyThreshold 8
545-
$poolSetting01 = New-AzureRmApplicationGatewayBackendHttpSettings -Name $poolSetting01Name -Port 80 -Protocol Http -Probe $probeHttp -CookieBasedAffinity Enabled -PickHostNameFromBackendAddress
548+
$probeHttp = New-AzureRmApplicationGatewayProbeConfig -Name $probeHttpName -Protocol Https -HostName "probe.com" -Path "/path/path.htm" -Interval 89 -Timeout 88 -UnhealthyThreshold 8
549+
$poolSetting01 = New-AzureRmApplicationGatewayBackendHttpSettings -Name $poolSetting01Name -Port 443 -Protocol Https -Probe $probeHttp -CookieBasedAffinity Enabled -PickHostNameFromBackendAddress -TrustedRootCertificate $trustedRoot01
546550

547551
#rule
548552
$rule01 = New-AzureRmApplicationGatewayRequestRoutingRule -Name $rule01Name -RuleType basic -BackendHttpSettings $poolSetting01 -HttpListener $listener01 -BackendAddressPool $pool
549553

550554
# sku
551-
$sku = New-AzureRmApplicationGatewaySku -Name Standard_v2 -Tier Standard_v2 -Capacity 2
555+
$sku = New-AzureRmApplicationGatewaySku -Name Standard_v2 -Tier Standard_v2
556+
557+
# autoscale configuration
558+
$autoscaleConfig = New-AzureRmApplicationGatewayAutoscaleConfiguration -MinCapacity 3
552559

553560
# security part
554561
$sslPolicy = New-AzureRmApplicationGatewaySslPolicy -PolicyType Custom -MinProtocolVersion TLSv1_1 -CipherSuite "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256", "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384", "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA", "TLS_RSA_WITH_AES_128_GCM_SHA256"
555562

556563
# Create Application Gateway
557-
$appgw = New-AzureRmApplicationGateway -Name $appgwName -ResourceGroupName $rgname -Zone 1,2 -Location $location -Probes $probeHttp -BackendAddressPools $pool -BackendHttpSettingsCollection $poolSetting01 -FrontendIpConfigurations $fipconfig -GatewayIpConfigurations $gipconfig -FrontendPorts $fp01 -HttpListeners $listener01 -RequestRoutingRules $rule01 -Sku $sku -SslPolicy $sslPolicy
564+
$appgw = New-AzureRmApplicationGateway -Name $appgwName -ResourceGroupName $rgname -Zone 1,2 -Location $location -Probes $probeHttp -BackendAddressPools $pool -BackendHttpSettingsCollection $poolSetting01 -FrontendIpConfigurations $fipconfig -GatewayIpConfigurations $gipconfig -FrontendPorts $fp01 -HttpListeners $listener01 -RequestRoutingRules $rule01 -Sku $sku -SslPolicy $sslPolicy -TrustedRootCertificate $trustedRoot01 -AutoscaleConfiguration $autoscaleConfig
565+
566+
# Get Application Gateway
567+
$getgw = Get-AzureRmApplicationGateway -Name $appgwName -ResourceGroupName $rgname
558568

559569
# Operational State
560-
Assert-AreEqual "Running" $appgw.OperationalState
570+
Assert-AreEqual "Running" $getgw.OperationalState
571+
572+
# check trusted root
573+
$trustedRoot02 = Get-AzureRmApplicationGatewayTrustedRootCertificate -ApplicationGateway $getgw -Name $trustedRootCertName
574+
Assert-NotNull $trustedRoot02
575+
Assert-AreEqual $getgw.BackendHttpSettingsCollection[0].TrustedRootCertificates.Count 1
576+
577+
# check autoscale configuration
578+
$autoscaleConfig01 = Get-AzureRmApplicationGatewayAutoscaleConfiguration -ApplicationGateway $getgw
579+
Assert-NotNull $autoscaleConfig01
580+
Assert-AreEqual $autoscaleConfig01.MinCapacity 3
561581

562582
# Get for zones
563-
Assert-AreEqual $appgw.Zones.Count 2
583+
Assert-AreEqual $getgw.Zones.Count 2
564584

565585
# Get for SslPolicy
566-
$sslPolicy01 = Get-AzureRmApplicationGatewaySslPolicy -ApplicationGateway $appgw
586+
$sslPolicy01 = Get-AzureRmApplicationGatewaySslPolicy -ApplicationGateway $getgw
567587
Assert-AreEqual $sslPolicy.MinProtocolVersion $sslPolicy01.MinProtocolVersion
568588

589+
# check autoscale configuration
590+
$autoscaleConfig01 = Get-AzureRmApplicationGatewayAutoscaleConfiguration -ApplicationGateway $getgw
591+
Assert-NotNull $autoscaleConfig01
592+
Assert-AreEqual $autoscaleConfig01.MinCapacity 3
593+
594+
# Next setup preparation
595+
596+
# remove autoscale config
597+
$getgw = Remove-AzureRmApplicationGatewayAutoscaleConfiguration -ApplicationGateway $getgw -Force
598+
$getgw = Set-AzureRmApplicationGatewaySku -Name Standard_v2 -Tier Standard_v2 -Capacity 3 -ApplicationGateway $getgw
599+
600+
# Set
601+
$getgw01 = Set-AzureRmApplicationGateway -ApplicationGateway $getgw
602+
603+
# check sku
604+
$sku01 = Get-AzureRmApplicationGatewaySku -ApplicationGateway $getgw01
605+
Assert-NotNull $sku01
606+
Assert-AreEqual $sku01.Capacity 3
607+
Assert-AreEqual $sku01.Name Standard_v2
608+
Assert-AreEqual $sku01.Tier Standard_v2
609+
569610
# Stop Application Gateway
570-
$getgw = Stop-AzureRmApplicationGateway -ApplicationGateway $appgw
611+
$getgw1 = Stop-AzureRmApplicationGateway -ApplicationGateway $getgw01
571612

572-
Assert-AreEqual "Stopped" $getgw.OperationalState
613+
Assert-AreEqual "Stopped" $getgw1.OperationalState
573614

574615
# Delete Application Gateway
575616
Remove-AzureRmApplicationGateway -Name $appgwName -ResourceGroupName $rgname -Force

0 commit comments

Comments
 (0)