Skip to content

Make arguments -MinScaleUnits and -MaxScaleUnits optional in Set-AzExpressRouteGateway #13428

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Network/Network/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
- Added parameter `-CoverageLevel`
- Added parameter `-Scope`
* Updated `New-AzNetworkWatcherConnectionMonitorProtocolConfigurationObject` cmdlet with new parameter `-DestinationPortBehavior`
* Made arguments `-MinScaleUnits` and `-MaxScaleUnits` optional in `Set-AzExpressRouteGateway`
* Added new cmdlets to support Mutual Authentication and SSL Profiles on Application Gateway
- `Get-AzApplicationGatewayClientAuthConfiguration`
- `New-AzApplicationGatewayClientAuthConfiguration`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ public class UpdateAzureRmExpressRouteGatewayCommand : ExpressRouteGatewayBaseCm
public string ResourceId { get; set; }

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

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

Expand Down Expand Up @@ -116,13 +116,16 @@ public override void Execute()
throw new PSArgumentException(Properties.Resources.ExpressRouteGatewayNotFound);
}

if (this.MinScaleUnits > this.MaxScaleUnits)
if (this.MinScaleUnits > 0 && this.MaxScaleUnits > 0)
{
throw new PSArgumentException(string.Format(Properties.Resources.InvalidAutoScaleConfiguration, this.MinScaleUnits, this.MaxScaleUnits));
}
if (this.MinScaleUnits > this.MaxScaleUnits)
{
throw new PSArgumentException(string.Format(Properties.Resources.InvalidAutoScaleConfiguration, this.MinScaleUnits, this.MaxScaleUnits));
}

existingExpressRouteGateway.AutoScaleConfiguration.Bounds.Min = Convert.ToInt32(this.MinScaleUnits);
existingExpressRouteGateway.AutoScaleConfiguration.Bounds.Max = Convert.ToInt32(this.MaxScaleUnits);
existingExpressRouteGateway.AutoScaleConfiguration.Bounds.Min = Convert.ToInt32(this.MinScaleUnits);
existingExpressRouteGateway.AutoScaleConfiguration.Bounds.Max = Convert.ToInt32(this.MaxScaleUnits);
}

ConfirmAction(
Properties.Resources.SettingResourceMessage,
Expand Down
10 changes: 5 additions & 5 deletions src/Network/Network/help/Set-AzExpressRouteGateway.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,28 @@ Updates a Scalable ExpressRoute Gateway.

### ByExpressRouteGatewayName (Default)
```
Set-AzExpressRouteGateway -ResourceGroupName <String> -Name <String> -MinScaleUnits <UInt32>
-MaxScaleUnits <UInt32> [-Tag <Hashtable>] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [-WhatIf]
Set-AzExpressRouteGateway -ResourceGroupName <String> -Name <String> [-MinScaleUnits <UInt32>]
[-MaxScaleUnits <UInt32>] [-Tag <Hashtable>] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [-WhatIf]
[-Confirm] [<CommonParameters>]
```

### ByExpressRouteGatewayObject
```
Set-AzExpressRouteGateway -InputObject <PSExpressRouteGateway> -MinScaleUnits <UInt32> -MaxScaleUnits <UInt32>
Set-AzExpressRouteGateway -InputObject <PSExpressRouteGateway> [-MinScaleUnits <UInt32>] [-MaxScaleUnits <UInt32>]
[-Tag <Hashtable>] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm]
[<CommonParameters>]
```

### ByExpressRouteGatewayResourceId
```
Set-AzExpressRouteGateway -ResourceId <String> -MinScaleUnits <UInt32> -MaxScaleUnits <UInt32>
Set-AzExpressRouteGateway -ResourceId <String> [-MinScaleUnits <UInt32>] [-MaxScaleUnits <UInt32>]
[-Tag <Hashtable>] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm]
[<CommonParameters>]
```

## DESCRIPTION

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

## EXAMPLES

Expand Down