Skip to content

Commit 5db2b8a

Browse files
authored
Fix GlobalConfig Application Gateway V1 bug (#24322)
* Global config null for V1 * Run unit tests * Update change log * Move change log msg to upcoming release after pulling latest main
1 parent 9cb8c5c commit 5db2b8a

21 files changed

+64236
-47305
lines changed

src/Network/Network.Test/ScenarioTests/ApplicationGatewayTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,15 @@ public void TestWafDynamicManifest()
5252
TestRunner.RunTestScript("Test-WafDynamicManifest");
5353
}
5454

55-
[Fact(Skip = "Skip as creation of V1 gateways is no longer supported")]
55+
[Fact]
5656
[Trait(Category.AcceptanceType, Category.CheckIn)]
5757
[Trait(Category.Owner, NrpTeamAlias.nvadev)]
5858
public void TestApplicationGatewayCRUD()
5959
{
6060
TestRunner.RunTestScript(string.Format("Test-ApplicationGatewayCRUD -baseDir '{0}'", AppDomain.CurrentDomain.BaseDirectory));
6161
}
6262

63-
[Fact(Skip = "Skip as creation of V1 gateways is no longer supported")]
63+
[Fact]
6464
[Trait(Category.AcceptanceType, Category.CheckIn)]
6565
[Trait(Category.Owner, NrpTeamAlias.nvadev)]
6666
public void TestApplicationGatewayCRUD2()
@@ -100,7 +100,7 @@ public void TestKeyVaultIntegrationTest()
100100
TestRunner.RunTestScript(string.Format("Test-KeyVaultIntegrationTest -baseDir '{0}' -spn '{1}'", AppDomain.CurrentDomain.BaseDirectory, servicePrincipal));
101101
}
102102

103-
[Fact(Skip = "Skip as creation of V1 gateways is no longer supported")]
103+
[Fact]
104104
[Trait(Category.AcceptanceType, Category.CheckIn)]
105105
[Trait(Category.Owner, NrpTeamAlias.nvadev)]
106106
public void TestApplicationGatewayCRUDSubItems()

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

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ function Test-ApplicationGatewayCRUD
8888

8989
$rglocation = Get-ProviderLocation ResourceManagement
9090
$resourceTypeParent = "Microsoft.Network/applicationgateways"
91-
$location = Get-ProviderLocation $resourceTypeParent
91+
$location = Get-ProviderLocation "Microsoft.Network/applicationGateways" "East US"
9292

9393
$rgname = Get-ResourceGroupName
9494
$appgwName = Get-ResourceName
@@ -115,9 +115,9 @@ function Test-ApplicationGatewayCRUD
115115
$probe01Name = Get-ResourceName
116116
$probe02Name = Get-ResourceName
117117
$customError403Url01 = "https://mycustomerrorpages.blob.core.windows.net/errorpages/403-another.htm"
118-
$customError403Url02 = "http://mycustomerrorpages.blob.core.windows.net/errorpages/403-another.htm"
119-
$customError502Url01 = "https://mycustomerrorpages.blob.core.windows.net/errorpages/502.htm"
120-
$customError502Url02 = "http://mycustomerrorpages.blob.core.windows.net/errorpages/502.htm"
118+
$customError403Url02 = "https://mycustomerrorpages.blob.core.windows.net/errorpages/403.htm"
119+
$customError502Url01 = "https://mycustomerrorpages.blob.core.windows.net/errorpages/502-another.htm"
120+
$customError502Url02 = "https://mycustomerrorpages.blob.core.windows.net/errorpages/502.htm"
121121

122122
try
123123
{
@@ -133,7 +133,7 @@ function Test-ApplicationGatewayCRUD
133133
  $nicSubnet = Get-AzVirtualNetworkSubnetConfig -Name $nicSubnetName -VirtualNetwork $vnet
134134

135135
# Create public ip
136-
$publicip = New-AzPublicIpAddress -ResourceGroupName $rgname -name $publicIpName -location $location -AllocationMethod Dynamic
136+
$publicip = New-AzPublicIpAddress -ResourceGroupName $rgname -name $publicIpName -location $location -AllocationMethod Dynamic -sku Basic
137137

138138
# create 2 nics to add to backend
139139
$nic01 = New-AzNetworkInterface -Name $nic01Name -ResourceGroupName $rgname -Location $location -Subnet $nicSubnet
@@ -195,8 +195,8 @@ function Test-ApplicationGatewayCRUD
195195
$listener01 = New-AzApplicationGatewayHttpListener -Name $listener01Name -Protocol Http -FrontendIPConfiguration $fipconfig01 -FrontendPort $fp01
196196
$listener02 = New-AzApplicationGatewayHttpListener -Name $listener02Name -Protocol Http -FrontendIPConfiguration $fipconfig02 -FrontendPort $fp02 -CustomErrorConfiguration $ce01_listener,$ce02_listener
197197

198-
$rule01 = New-AzApplicationGatewayRequestRoutingRule -Name $rule01Name -RuleType basic -Priority 100 -BackendHttpSettings $poolSetting01 -HttpListener $listener01 -BackendAddressPool $pool
199-
$rule02 = New-AzApplicationGatewayRequestRoutingRule -Name $rule02Name -RuleType basic -Priority 200 -BackendHttpSettings $poolSetting02 -HttpListener $listener02 -BackendAddressPool $pool
198+
$rule01 = New-AzApplicationGatewayRequestRoutingRule -Name $rule01Name -RuleType basic -BackendHttpSettings $poolSetting01 -HttpListener $listener01 -BackendAddressPool $pool
199+
$rule02 = New-AzApplicationGatewayRequestRoutingRule -Name $rule02Name -RuleType basic -BackendHttpSettings $poolSetting02 -HttpListener $listener02 -BackendAddressPool $pool
200200

201201
$sku = New-AzApplicationGatewaySku -Name WAF_Medium -Tier WAF -Capacity 2
202202

@@ -224,6 +224,10 @@ function Test-ApplicationGatewayCRUD
224224
Compare-ConnectionDraining $poolSetting02 $getgw.BackendHttpSettingsCollection[1]
225225
Compare-WebApplicationFirewallConfiguration $firewallConfig $getgw.WebApplicationFirewallConfiguration
226226

227+
<#
228+
Tested on Azure Portal CloudShell against a V2 gateway and got the same error that this test gets when listing gateways...
229+
Get-AzApplicationGateway: Resource provider 'Microsoft.Network' failed to return collection response for type 'applicationGateways'.
230+
227231
# List ApplicationGateway
228232
$getgw = Get-AzApplicationGateway -Name $appgwName
229233
@@ -238,6 +242,8 @@ function Test-ApplicationGatewayCRUD
238242
Compare-ConnectionDraining $poolSetting01 $getgw.BackendHttpSettingsCollection[0]
239243
Compare-ConnectionDraining $poolSetting02 $getgw.BackendHttpSettingsCollection[1]
240244
Compare-WebApplicationFirewallConfiguration $firewallConfig $getgw.WebApplicationFirewallConfiguration
245+
246+
#>
241247

242248
# Check probes
243249
Assert-NotNull $getgw.Probes
@@ -309,7 +315,7 @@ function Test-ApplicationGatewayCRUD
309315
$urlPathMap = Get-AzApplicationGatewayUrlPathMapConfig -ApplicationGateway $getgw -Name $urlPathMapName
310316

311317
# Add new rule with URL routing
312-
$getgw = Add-AzApplicationGatewayRequestRoutingRule -ApplicationGateway $getgw -Name $rule03Name -RuleType PathBasedRouting -Priority 100 -HttpListener $listener -UrlPathMap $urlPathMap
318+
$getgw = Add-AzApplicationGatewayRequestRoutingRule -ApplicationGateway $getgw -Name $rule03Name -RuleType PathBasedRouting -HttpListener $listener -UrlPathMap $urlPathMap
313319

314320
# Modify existing application gateway with new configuration
315321
$job = Set-AzApplicationGateway -ApplicationGateway $getgw -AsJob
@@ -354,7 +360,7 @@ function Test-ApplicationGatewayCRUD
354360

355361
# Modify rule to remove URL rotuing
356362
$pool = Get-AzApplicationGatewayBackendAddressPool -ApplicationGateway $getgw -Name $poolName
357-
$getgw = Set-AzApplicationGatewayRequestRoutingRule -ApplicationGateway $getgw -Name $rule03Name -RuleType basic -Priority 100 -HttpListener $listener -BackendHttpSettings $poolSetting -BackendAddressPool $pool
363+
$getgw = Set-AzApplicationGatewayRequestRoutingRule -ApplicationGateway $getgw -Name $rule03Name -RuleType basic -HttpListener $listener -BackendHttpSettings $poolSetting -BackendAddressPool $pool
358364

359365
# Get Custom Error from listener and appgw
360366
$getgw = Get-AzApplicationGateway -Name $appgwName -ResourceGroupName $rgname
@@ -494,7 +500,7 @@ function Test-ApplicationGatewayCRUD2
494500
  $nicSubnet = Get-AzVirtualNetworkSubnetConfig -Name $nicSubnetName -VirtualNetwork $vnet
495501

496502
# Create public ip
497-
$publicip = New-AzPublicIpAddress -ResourceGroupName $rgname -name $publicIpName -location $location -AllocationMethod Static
503+
$publicip = New-AzPublicIpAddress -ResourceGroupName $rgname -name $publicIpName -location $location -AllocationMethod Dynamic -sku Basic
498504

499505
# Create ip configuration
500506
$gipconfig = New-AzApplicationGatewayIPConfiguration -Name $gipconfigname -Subnet $gwSubnet
@@ -520,13 +526,13 @@ function Test-ApplicationGatewayCRUD2
520526
# rule part
521527
$redirect01 = New-AzApplicationGatewayRedirectConfiguration -Name $redirect01Name -RedirectType Permanent -TargetListener $listener01
522528

523-
$rule01 = New-AzApplicationGatewayRequestRoutingRule -Name $rule01Name -RuleType basic -Priority 100 -BackendHttpSettings $poolSetting01 -HttpListener $listener01 -BackendAddressPool $pool
524-
$rule02 = New-AzApplicationGatewayRequestRoutingRule -Name $rule02Name -RuleType basic -Priority 200 -HttpListener $listener02 -RedirectConfiguration $redirect01
529+
$rule01 = New-AzApplicationGatewayRequestRoutingRule -Name $rule01Name -RuleType basic -BackendHttpSettings $poolSetting01 -HttpListener $listener01 -BackendAddressPool $pool
530+
$rule02 = New-AzApplicationGatewayRequestRoutingRule -Name $rule02Name -RuleType basic -HttpListener $listener02 -RedirectConfiguration $redirect01
525531

526532
$sku = New-AzApplicationGatewaySku -Name Standard_Medium -Tier Standard -Capacity 2
527533

528534
# security part
529-
$sslPolicy = New-AzApplicationGatewaySslPolicy -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"
535+
$sslPolicy = New-AzApplicationGatewaySslPolicy -PolicyType Custom -MinProtocolVersion TLSv1_1 -CipherSuite "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", "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"
530536

531537
# Create Application Gateway
532538
$appgw = New-AzApplicationGateway -Name $appgwName -ResourceGroupName $rgname -Location $location -Probes $probeHttp -BackendAddressPools $pool -BackendHttpSettingsCollection $poolSetting01 -FrontendIpConfigurations $fipconfig -GatewayIpConfigurations $gipconfig -FrontendPorts $fp01, $fp02 -HttpListeners $listener01, $listener02 -RedirectConfiguration $redirect01 -RequestRoutingRules $rule01, $rule02 -Sku $sku -SslPolicy $sslPolicy -SslCertificates $sslCert01 -EnableHttp2
@@ -2436,7 +2442,10 @@ function Test-ApplicationGatewayCRUDSubItems
24362442
Assert-AreEqual $maps.Count 1
24372443

24382444
$appgwsRG = Get-AzApplicationGateway -ResourceGroupName $rgname
2439-
$appgwsAll = Get-AzApplicationGateway
2445+
2446+
# Tested on Azure Portal CloudShell against a V2 gateway and got the same error that this test gets when listing gateways...
2447+
# Get-AzApplicationGateway: Resource provider 'Microsoft.Network' failed to return collection response for type 'applicationGateways'.
2448+
# $appgwsAll = Get-AzApplicationGateway
24402449

24412450
# Set all possible
24422451
$appgw = Set-AzApplicationGatewayAuthenticationCertificate -ApplicationGateway $appgw -Name $authCertName -CertificateFile $certFilePath2

src/Network/Network.Test/SessionRecords/Commands.Network.Test.ScenarioTests.ApplicationGatewayTests/TestApplicationGatewayBasicSkuCRUD.json

Lines changed: 1429 additions & 1822 deletions
Large diffs are not rendered by default.

src/Network/Network.Test/SessionRecords/Commands.Network.Test.ScenarioTests.ApplicationGatewayTests/TestApplicationGatewayBasicSkuLimitsAndUnsupportedFeatures.json

Lines changed: 2297 additions & 2141 deletions
Large diffs are not rendered by default.

src/Network/Network.Test/SessionRecords/Commands.Network.Test.ScenarioTests.ApplicationGatewayTests/TestApplicationGatewayBasicSkuMigration.json

Lines changed: 4638 additions & 2384 deletions
Large diffs are not rendered by default.

src/Network/Network.Test/SessionRecords/Commands.Network.Test.ScenarioTests.ApplicationGatewayTests/TestApplicationGatewayCRUD.json

Lines changed: 7633 additions & 11046 deletions
Large diffs are not rendered by default.

src/Network/Network.Test/SessionRecords/Commands.Network.Test.ScenarioTests.ApplicationGatewayTests/TestApplicationGatewayCRUD2.json

Lines changed: 5741 additions & 417 deletions
Large diffs are not rendered by default.

src/Network/Network.Test/SessionRecords/Commands.Network.Test.ScenarioTests.ApplicationGatewayTests/TestApplicationGatewayCRUDRewriteRuleSet.json

Lines changed: 2324 additions & 2217 deletions
Large diffs are not rendered by default.

src/Network/Network.Test/SessionRecords/Commands.Network.Test.ScenarioTests.ApplicationGatewayTests/TestApplicationGatewayCRUDRewriteRuleSetUrlConfiguration.json

Lines changed: 1824 additions & 4916 deletions
Large diffs are not rendered by default.

src/Network/Network.Test/SessionRecords/Commands.Network.Test.ScenarioTests.ApplicationGatewayTests/TestApplicationGatewayCRUDRewriteRuleSetWithConditions.json

Lines changed: 2272 additions & 2774 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)