@@ -485,6 +485,100 @@ function Test-ApplicationGatewayCRUD2
485
485
}
486
486
}
487
487
488
+ <#
489
+ . SYNOPSIS
490
+ Application gateway v2 tests
491
+ #>
492
+ function Test-ApplicationGatewayCRUD3
493
+ {
494
+ param
495
+ (
496
+ $basedir = " ./"
497
+ )
498
+
499
+ # Setup
500
+ $location = " westus2"
501
+
502
+ $rgname = Get-ResourceGroupName
503
+ $appgwName = Get-ResourceName
504
+ $vnetName = Get-ResourceName
505
+ $gwSubnetName = Get-ResourceName
506
+ $publicIpName = Get-ResourceName
507
+ $gipconfigname = Get-ResourceName
508
+
509
+ $frontendPort01Name = Get-ResourceName
510
+ $fipconfigName = Get-ResourceName
511
+ $listener01Name = Get-ResourceName
512
+
513
+ $poolName = Get-ResourceName
514
+ $poolSetting01Name = Get-ResourceName
515
+
516
+ $rule01Name = Get-ResourceName
517
+
518
+ $probeHttpName = Get-ResourceName
519
+
520
+ try
521
+ {
522
+ # Create the resource group
523
+ $resourceGroup = New-AzureRmResourceGroup - Name $rgname - Location $location - Tags @ { testtag = " APPGw tag" }
524
+ # Create the Virtual Network
525
+ $gwSubnet = New-AzureRmVirtualNetworkSubnetConfig - Name $gwSubnetName - AddressPrefix 10.0 .0.0 / 24
526
+ $vnet = New-AzureRmvirtualNetwork - Name $vnetName - ResourceGroupName $rgname - Location $location - AddressPrefix 10.0 .0.0 / 16 - Subnet $gwSubnet
527
+ $vnet = Get-AzureRmvirtualNetwork - Name $vnetName - ResourceGroupName $rgname
528
+ $gwSubnet = Get-AzureRmVirtualNetworkSubnetConfig - Name $gwSubnetName - VirtualNetwork $vnet
529
+
530
+ # Create public ip
531
+ $publicip = New-AzureRmPublicIpAddress - ResourceGroupName $rgname - name $publicIpName - location $location - AllocationMethod Static - sku Standard
532
+
533
+ # Create ip configuration
534
+ $gipconfig = New-AzureRmApplicationGatewayIPConfiguration - Name $gipconfigname - Subnet $gwSubnet
535
+
536
+ $fipconfig = New-AzureRmApplicationGatewayFrontendIPConfig - Name $fipconfigName - PublicIPAddress $publicip
537
+ $fp01 = New-AzureRmApplicationGatewayFrontendPort - Name $frontendPort01Name - Port 80
538
+ $listener01 = New-AzureRmApplicationGatewayHttpListener - Name $listener01Name - Protocol Http - FrontendIPConfiguration $fipconfig - FrontendPort $fp01
539
+
540
+ # backend part
541
+ $pool = New-AzureRmApplicationGatewayBackendAddressPool - Name $poolName - BackendIPAddresses www.microsoft.com , www.bing.com
542
+ $probeHttp = New-AzureRmApplicationGatewayProbeConfig - Name $probeHttpName - Protocol Http - HostName " probe.com" - Path " /path/path.htm" - Interval 89 - Timeout 88 - UnhealthyThreshold 8
543
+ $poolSetting01 = New-AzureRmApplicationGatewayBackendHttpSettings - Name $poolSetting01Name - Port 80 - Protocol Http - Probe $probeHttp - CookieBasedAffinity Enabled - PickHostNameFromBackendAddress
544
+
545
+ # rule
546
+ $rule01 = New-AzureRmApplicationGatewayRequestRoutingRule - Name $rule01Name - RuleType basic - BackendHttpSettings $poolSetting01 - HttpListener $listener01 - BackendAddressPool $pool
547
+
548
+ # sku
549
+ $sku = New-AzureRmApplicationGatewaySku - Name Standard_v2 - Tier Standard_v2 - Capacity 2
550
+
551
+ # security part
552
+ $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"
553
+
554
+ # Create Application Gateway
555
+ $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
556
+
557
+ # Operational State
558
+ Assert-AreEqual " Running" $appgw.OperationalState
559
+
560
+ # Get for zones
561
+ Assert-AreEqual $appgw.Zones.Count 2
562
+
563
+ # Get for SslPolicy
564
+ $sslPolicy01 = Get-AzureRmApplicationGatewaySslPolicy - ApplicationGateway $appgw
565
+ Assert-AreEqual $sslPolicy.MinProtocolVersion $sslPolicy01.MinProtocolVersion
566
+
567
+ # Stop Application Gateway
568
+ $getgw = Stop-AzureRmApplicationGateway - ApplicationGateway $appgw
569
+
570
+ Assert-AreEqual " Stopped" $getgw.OperationalState
571
+
572
+ # Delete Application Gateway
573
+ Remove-AzureRmApplicationGateway - Name $appgwName - ResourceGroupName $rgname - Force
574
+ }
575
+ finally
576
+ {
577
+ # Cleanup
578
+ Clean - ResourceGroup $rgname
579
+ }
580
+ }
581
+
488
582
<#
489
583
. SYNOPSIS
490
584
Compare connectionDraining of backendhttpsettings
0 commit comments