Skip to content

Commit f923b20

Browse files
nimallerisra-fel
andauthored
Make arguments -MinScaleUnits and -MaxScaleUnits optional in Set-AzExpressRouteGateway (#13428)
* make scaling unit optional * make scaling unit optional make scaling unit optional Co-authored-by: Yeming Liu <[email protected]>
1 parent e44c934 commit f923b20

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

src/Network/Network/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
- Added parameter `-CoverageLevel`
3838
- Added parameter `-Scope`
3939
* Updated `New-AzNetworkWatcherConnectionMonitorProtocolConfigurationObject` cmdlet with new parameter `-DestinationPortBehavior`
40+
* Made arguments `-MinScaleUnits` and `-MaxScaleUnits` optional in `Set-AzExpressRouteGateway`
4041
* Added new cmdlets to support Mutual Authentication and SSL Profiles on Application Gateway
4142
- `Get-AzApplicationGatewayClientAuthConfiguration`
4243
- `New-AzApplicationGatewayClientAuthConfiguration`

src/Network/Network/Cortex/ExpressRouteGateway/SetAzureRmExpressRouteGatewayCommand.cs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ public class UpdateAzureRmExpressRouteGatewayCommand : ExpressRouteGatewayBaseCm
7171
public string ResourceId { get; set; }
7272

7373
[Parameter(
74-
Mandatory = true,
74+
Mandatory = false,
7575
HelpMessage = "Min for the scale units for this ExpressRouteGateway.")]
7676
public uint MinScaleUnits { get; set; }
7777

7878
[Parameter(
79-
Mandatory = true,
79+
Mandatory = false,
8080
HelpMessage = "Max for the scale units for this ExpressRouteGateway.")]
8181
public uint MaxScaleUnits { get; set; }
8282

@@ -116,13 +116,16 @@ public override void Execute()
116116
throw new PSArgumentException(Properties.Resources.ExpressRouteGatewayNotFound);
117117
}
118118

119-
if (this.MinScaleUnits > this.MaxScaleUnits)
119+
if (this.MinScaleUnits > 0 && this.MaxScaleUnits > 0)
120120
{
121-
throw new PSArgumentException(string.Format(Properties.Resources.InvalidAutoScaleConfiguration, this.MinScaleUnits, this.MaxScaleUnits));
122-
}
121+
if (this.MinScaleUnits > this.MaxScaleUnits)
122+
{
123+
throw new PSArgumentException(string.Format(Properties.Resources.InvalidAutoScaleConfiguration, this.MinScaleUnits, this.MaxScaleUnits));
124+
}
123125

124-
existingExpressRouteGateway.AutoScaleConfiguration.Bounds.Min = Convert.ToInt32(this.MinScaleUnits);
125-
existingExpressRouteGateway.AutoScaleConfiguration.Bounds.Max = Convert.ToInt32(this.MaxScaleUnits);
126+
existingExpressRouteGateway.AutoScaleConfiguration.Bounds.Min = Convert.ToInt32(this.MinScaleUnits);
127+
existingExpressRouteGateway.AutoScaleConfiguration.Bounds.Max = Convert.ToInt32(this.MaxScaleUnits);
128+
}
126129

127130
ConfirmAction(
128131
Properties.Resources.SettingResourceMessage,

src/Network/Network/help/Set-AzExpressRouteGateway.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,28 @@ Updates a Scalable ExpressRoute Gateway.
1414

1515
### ByExpressRouteGatewayName (Default)
1616
```
17-
Set-AzExpressRouteGateway -ResourceGroupName <String> -Name <String> -MinScaleUnits <UInt32>
18-
-MaxScaleUnits <UInt32> [-Tag <Hashtable>] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [-WhatIf]
17+
Set-AzExpressRouteGateway -ResourceGroupName <String> -Name <String> [-MinScaleUnits <UInt32>]
18+
[-MaxScaleUnits <UInt32>] [-Tag <Hashtable>] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [-WhatIf]
1919
[-Confirm] [<CommonParameters>]
2020
```
2121

2222
### ByExpressRouteGatewayObject
2323
```
24-
Set-AzExpressRouteGateway -InputObject <PSExpressRouteGateway> -MinScaleUnits <UInt32> -MaxScaleUnits <UInt32>
24+
Set-AzExpressRouteGateway -InputObject <PSExpressRouteGateway> [-MinScaleUnits <UInt32>] [-MaxScaleUnits <UInt32>]
2525
[-Tag <Hashtable>] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm]
2626
[<CommonParameters>]
2727
```
2828

2929
### ByExpressRouteGatewayResourceId
3030
```
31-
Set-AzExpressRouteGateway -ResourceId <String> -MinScaleUnits <UInt32> -MaxScaleUnits <UInt32>
31+
Set-AzExpressRouteGateway -ResourceId <String> [-MinScaleUnits <UInt32>] [-MaxScaleUnits <UInt32>]
3232
[-Tag <Hashtable>] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm]
3333
[<CommonParameters>]
3434
```
3535

3636
## DESCRIPTION
3737

38-
Set-AzExpressRouteGateway updates the scale units for the ExpressRouteGateway
38+
The **Set-AzExpressRouteGateway** cmdlet enables you to update the scale units for an existing ExpressRouteGateway or update the resource tags.
3939

4040
## EXAMPLES
4141

0 commit comments

Comments
 (0)