Skip to content

Commit 6bc726d

Browse files
authored
Merge pull request Azure#9584 from abjai/urlrewrite
Application Gateway New-AzApplicationGatewayProbeConfig command update for supporting custom port in Probe
2 parents 6df8123 + 83da504 commit 6bc726d

File tree

7 files changed

+6122
-6515
lines changed

7 files changed

+6122
-6515
lines changed

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ function Test-ApplicationGatewayCRUDRewriteRuleSet
638638
$certFilePath = $basedir + "/ScenarioTests/Data/ApplicationGatewayAuthCert.cer"
639639
$trustedRoot01 = New-AzApplicationGatewayTrustedRootCertificate -Name $trustedRootCertName -CertificateFile $certFilePath
640640
$pool = New-AzApplicationGatewayBackendAddressPool -Name $poolName -BackendIPAddresses www.microsoft.com, www.bing.com
641-
$probeHttp = New-AzApplicationGatewayProbeConfig -Name $probeHttpName -Protocol Https -HostName "probe.com" -Path "/path/path.htm" -Interval 89 -Timeout 88 -UnhealthyThreshold 8
641+
$probeHttp = New-AzApplicationGatewayProbeConfig -Name $probeHttpName -Protocol Https -HostName "probe.com" -Path "/path/path.htm" -Interval 89 -Timeout 88 -UnhealthyThreshold 8 -port 1234
642642
$poolSetting01 = New-AzApplicationGatewayBackendHttpSettings -Name $poolSetting01Name -Port 443 -Protocol Https -Probe $probeHttp -CookieBasedAffinity Enabled -PickHostNameFromBackendAddress -TrustedRootCertificate $trustedRoot01
643643

644644
#Rewrite Rule Set
@@ -754,6 +754,19 @@ function Test-ApplicationGatewayCRUDRewriteRuleSet
754754
Assert-AreEqual $sku01.Name Standard_v2
755755
Assert-AreEqual $sku01.Tier Standard_v2
756756

757+
# check probe
758+
$probe01 = Get-AzApplicationGatewayProbeConfig -ApplicationGateway $getgw01
759+
Assert-NotNull $probe01
760+
Assert-AreEqual $probe01.Port 1234
761+
Assert-AreEqual $probe01.Host "probe.com"
762+
Assert-AreEqual $probe01.Path "/path/path.htm"
763+
Assert-AreEqual $probe01.Interval 89
764+
Assert-AreEqual $probe01.Timeout 88
765+
Assert-AreEqual $probe01.UnhealthyThreshold 8
766+
767+
Assert-ThrowsLike { Set-AzApplicationGatewayProbeConfig -ApplicationGateway $getgw01 -Name "fakeName" -Protocol Https -HostName "probe.com" -Path "/path/path.htm" -Interval 89 -Timeout 88 -UnhealthyThreshold 8 -port 1234} "*does not exist*"
768+
Assert-ThrowsLike { Add-AzApplicationGatewayProbeConfig -ApplicationGateway $getgw01 -Name $probeHttpName -Protocol Https -HostName "probe.com" -Path "/path/path.htm" -Interval 89 -Timeout 88 -UnhealthyThreshold 8 -port 1234} "*already exists*"
769+
757770
# Stop Application Gateway
758771
$getgw1 = Stop-AzApplicationGateway -ApplicationGateway $getgw01
759772

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

Lines changed: 2610 additions & 4075 deletions
Large diffs are not rendered by default.

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

Lines changed: 3469 additions & 2438 deletions
Large diffs are not rendered by default.

src/Network/Network/ApplicationGateway/Probe/AzureApplicationGatewayProbeConfigBase.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ public class AzureApplicationGatewayProbeConfigBase : NetworkBaseCmdlet
7474
[ValidateRange(0, int.MaxValue)]
7575
public int MinServers { get; set; }
7676

77+
[Parameter(
78+
Mandatory = false,
79+
HelpMessage = "Port that is used for probing the backend server")]
80+
[ValidateRange(1, 65535)]
81+
public int Port { get; set; }
82+
7783
[Parameter(
7884
Mandatory = false,
7985
HelpMessage = "Body that must be contained in the health response. Default value is empty")]
@@ -96,6 +102,10 @@ public PSApplicationGatewayProbe NewObject()
96102
}
97103
probe.MinServers = this.MinServers;
98104
probe.Match = this.Match;
105+
if (this.Port != 0)
106+
{
107+
probe.Port = this.Port;
108+
}
99109

100110
probe.Id =
101111
ApplicationGatewayChildResourceHelper.GetResourceNotSetId(

src/Network/Network/ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@
4444
- New-AzLoadBalancerFrontendIpConfig
4545
- Add-AzLoadBalancerFrontendIpConfig
4646
- Set-AzLoadBalancerFrontendIpConfig
47+
* Application Gateway New-AzApplicationGatewayProbeConfig command update for supporting custom port in Probe
48+
- Updated New-AzApplicationGatewayProbeConfig: Added optional parameter Port which is used for probing backend server. This parameter is applicable for Standard_V2 and WAF_V2 SKU.
4749

4850
## Version 1.11.0
4951
* Added `RoutingPreference` to public ip tags

src/Network/Network/Models/PSApplicationGatewayProbe.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ public class PSApplicationGatewayProbe : PSChildResource
3636
public bool? PickHostNameFromBackendHttpSettings { get; set; }
3737
[Ps1Xml(Target = ViewControl.Table)]
3838
public int? MinServers { get; set; }
39+
[Ps1Xml(Target = ViewControl.Table)]
40+
public int? Port { get; set; }
3941
public PSApplicationGatewayProbeHealthResponseMatch Match { get; set; }
4042
[Ps1Xml(Target = ViewControl.Table)]
4143
public string ProvisioningState { get; set; }

src/Network/Network/help/New-AzApplicationGatewayProbeConfig.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Creates a health probe.
1616
New-AzApplicationGatewayProbeConfig -Name <String> -Protocol <String> [-HostName <String>] -Path <String>
1717
-Interval <Int32> -Timeout <Int32> -UnhealthyThreshold <Int32> [-PickHostNameFromBackendHttpSettings]
1818
[-MinServers <Int32>] [-Match <PSApplicationGatewayProbeHealthResponseMatch>]
19-
[-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
19+
[-DefaultProfile <IAzureContextContainer>] [<CommonParameters>] [-Port <Int32>]
2020
```
2121

2222
## DESCRIPTION
@@ -210,6 +210,20 @@ Accept pipeline input: False
210210
Accept wildcard characters: False
211211
```
212212
213+
### -Port
214+
Specifies the port used for probing backend servers.
215+
216+
```yaml
217+
Type: System.Int32
218+
Parameter Sets: (All)
219+
Aliases:
220+
221+
Required: False
222+
Position: Named
223+
Default value: None
224+
Accept pipeline input: False
225+
Accept wildcard characters: False
226+
213227
### CommonParameters
214228
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
215229

0 commit comments

Comments
 (0)