@@ -513,6 +513,7 @@ function Test-ApplicationGatewayCRUD3
513
513
$listener01Name = Get-ResourceName
514
514
515
515
$poolName = Get-ResourceName
516
+ $trustedRootCertName = Get-ResourceName
516
517
$poolSetting01Name = Get-ResourceName
517
518
518
519
$rule01Name = Get-ResourceName
@@ -540,36 +541,76 @@ function Test-ApplicationGatewayCRUD3
540
541
$listener01 = New-AzureRmApplicationGatewayHttpListener - Name $listener01Name - Protocol Http - FrontendIPConfiguration $fipconfig - FrontendPort $fp01
541
542
542
543
# backend part
544
+ # trusted root cert part
545
+ $certFilePath = $basedir + " /ScenarioTests/Data/ApplicationGatewayAuthCert.cer"
546
+ $trustedRoot01 = New-AzureRmApplicationGatewayTrustedRootCertificate - Name $trustedRootCertName - CertificateFile $certFilePath
543
547
$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
546
550
547
551
# rule
548
552
$rule01 = New-AzureRmApplicationGatewayRequestRoutingRule - Name $rule01Name - RuleType basic - BackendHttpSettings $poolSetting01 - HttpListener $listener01 - BackendAddressPool $pool
549
553
550
554
# 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
552
559
553
560
# security part
554
561
$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"
555
562
556
563
# 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
558
568
559
569
# 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
561
581
562
582
# Get for zones
563
- Assert-AreEqual $appgw .Zones.Count 2
583
+ Assert-AreEqual $getgw .Zones.Count 2
564
584
565
585
# Get for SslPolicy
566
- $sslPolicy01 = Get-AzureRmApplicationGatewaySslPolicy - ApplicationGateway $appgw
586
+ $sslPolicy01 = Get-AzureRmApplicationGatewaySslPolicy - ApplicationGateway $getgw
567
587
Assert-AreEqual $sslPolicy.MinProtocolVersion $sslPolicy01.MinProtocolVersion
568
588
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
+
569
610
# Stop Application Gateway
570
- $getgw = Stop-AzureRmApplicationGateway - ApplicationGateway $appgw
611
+ $getgw1 = Stop-AzureRmApplicationGateway - ApplicationGateway $getgw01
571
612
572
- Assert-AreEqual " Stopped" $getgw .OperationalState
613
+ Assert-AreEqual " Stopped" $getgw1 .OperationalState
573
614
574
615
# Delete Application Gateway
575
616
Remove-AzureRmApplicationGateway - Name $appgwName - ResourceGroupName $rgname - Force
0 commit comments