Skip to content

Commit 9c3b6ca

Browse files
authored
Merge pull request #4180 from henry416/preview
Default values & bounds for SAs in Ipsec Policy
2 parents 65a956c + 07b0e39 commit 9c3b6ca

File tree

5 files changed

+784903
-1490
lines changed

5 files changed

+784903
-1490
lines changed

src/ResourceManager/Network/ChangeLog.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,17 @@
1818
- Additional information about change #1
1919
-->
2020
## Current Release
21+
* New-AzureRmIpsecPolicy: SALifeTimeSeconds and SADataSizeKilobytes are no longer mandatory parameters
22+
   - SALifeTimeSeconds defaults to 27000 seconds
23+
   - SADataSizeKilobytes defaults to 102400000 KB
2124

2225
## Version 4.1.0
2326
* Get-AzureRmNetworkUsage: New cmdlet to show network usage and capacity details
2427
* Added new GatewaySku options for VirtualNetworkGateways
2528
- VpnGw1, VpnGw2, VpnGw3 are the new Skus added for Vpn gateways
2629
* Set-AzureRmNetworkWatcherConfigFlowLog
2730
* Fixed help examples
28-
31+
2932
## Version 4.0.1
3033

3134
## Version 4.0.0
@@ -115,4 +118,4 @@
115118
    - Fixed issue where UseRemoteGateway property was not being populated in the request to the server
116119
* Get-AzureRmEffectiveNetworkSecurityGroup
117120
    - Add warning if there is no response from GetEffectiveNSG
118-
* Add Source property to EffectiveRoute
121+
* Add Source property to EffectiveRoute

src/ResourceManager/Network/Commands.Network.Test/ScenarioTests/VirtualNetworkGatewayConnectionTests.ps1

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ function Test-VirtualNetworkGatewayConnectionWithIpsecPoliciesCRUD
143143
$rglocation = Get-ProviderLocation ResourceManagement
144144
$resourceTypeParent = "Microsoft.Network/connections"
145145
$location = Get-ProviderLocation $resourceTypeParent
146-
146+
147147
try
148148
{
149149
# Create the resource group
@@ -167,8 +167,11 @@ function Test-VirtualNetworkGatewayConnectionWithIpsecPoliciesCRUD
167167
$actual = New-AzureRmLocalNetworkGateway -ResourceGroupName $rgname -name $localnetName -location $location -AddressPrefix 192.168.0.0/16 -GatewayIpAddress 192.168.3.10
168168
$localnetGateway = Get-AzureRmLocalNetworkGateway -ResourceGroupName $rgname -name $localnetName
169169

170-
# Create IpsecPolicy
171-
$ipsecPolicy = New-AzureRmIpsecPolicy -SALifeTimeSeconds 300 -SADataSizeKilobytes 1024 -IpsecEncryption "GCMAES256" -IpsecIntegrity "GCMAES256" -IkeEncryption "AES256" -IkeIntegrity "SHA256" -DhGroup "DHGroup14" -PfsGroup "PFS2048"
170+
# Create IpsecPolicy and test defaults creation
171+
$ipsecPolicy = New-AzureRmIpsecPolicy -IpsecEncryption "GCMAES256" -IpsecIntegrity "GCMAES256" -IkeEncryption "AES256" -IkeIntegrity "SHA256" -DhGroup "DHGroup14" -PfsGroup "PFS2048"
172+
Assert-AreEqual $ipsecPolicy.SALifeTimeSeconds 27000
173+
Assert-AreEqual $ipsecPolicy.SADataSizeKilobytes 102400000
174+
$ipsecPolicy = New-AzureRmIpsecPolicy -SALifeTimeSeconds 3000 -SADataSizeKilobytes 10000 -IpsecEncryption "GCMAES256" -IpsecIntegrity "GCMAES256" -IkeEncryption "AES256" -IkeIntegrity "SHA256" -DhGroup "DHGroup14" -PfsGroup "PFS2048"
172175

173176
# Create & Get VirtualNetworkGatewayConnection w/ policy based TS
174177
$actual = New-AzureRmVirtualNetworkGatewayConnection -ResourceGroupName $rgname -name $vnetConnectionName -location $location -VirtualNetworkGateway1 $vnetGateway -LocalNetworkGateway2 $localnetGateway -ConnectionType IPsec -RoutingWeight 3 -SharedKey abc -EnableBgp $false -UsePolicyBasedTrafficSelectors $true -IpsecPolicies $ipsecPolicy

src/ResourceManager/Network/Commands.Network.Test/SessionRecords/Commands.Network.Test.ScenarioTests.VirtualNetworkGatewayConnectionTests/TestVirtualNetworkGatewayConnectionwithIpsecPoliciesCRUD.json

Lines changed: 784881 additions & 1478 deletions
Large diffs are not rendered by default.

src/ResourceManager/Network/Commands.Network/VirtualNetworkGatewayConnection/NewAzureRmIpsecPolicyCommand.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ namespace Microsoft.Azure.Commands.Network
2222
public class NewAzureRmIpsecPolicyCommand : NetworkBaseCmdlet
2323
{
2424
[Parameter(
25-
Mandatory = true,
25+
Mandatory = false,
2626
HelpMessage = "The IPSec Security Association (also called Quick Mode or Phase 2 SA) lifetime in seconds")]
27-
[ValidateNotNullOrEmpty]
27+
[ValidateRange(300, 172799)]
2828
public int SALifeTimeSeconds { get; set; }
2929

3030
[Parameter(
31-
Mandatory = true,
31+
Mandatory = false,
3232
HelpMessage = "The IPSec Security Association (also called Quick Mode or Phase 2 SA) payload size in KB")]
33-
[ValidateNotNullOrEmpty]
33+
[ValidateRange(1024, int.MaxValue)]
3434
public int SADataSizeKilobytes { get; set; }
3535

3636
[Parameter(
@@ -125,8 +125,10 @@ public override void Execute()
125125
base.Execute();
126126
var ipsecPolicy = new PSIpsecPolicy();
127127

128-
ipsecPolicy.SALifeTimeSeconds = this.SALifeTimeSeconds;
129-
ipsecPolicy.SADataSizeKilobytes = this.SADataSizeKilobytes;
128+
// default SA values
129+
ipsecPolicy.SALifeTimeSeconds = (!this.MyInvocation.BoundParameters.ContainsKey("SALifeTimeSeconds")) ? 27000 : this.SALifeTimeSeconds;
130+
ipsecPolicy.SADataSizeKilobytes = (!this.MyInvocation.BoundParameters.ContainsKey("SADataSizeKilobytes")) ? 102400000 : this.SADataSizeKilobytes;
131+
130132
ipsecPolicy.IpsecEncryption = this.IpsecEncryption;
131133
ipsecPolicy.IpsecIntegrity = this.IpsecIntegrity;
132134
ipsecPolicy.IkeEncryption = this.IkeEncryption;

tools/StaticAnalysis/Exceptions/BreakingChangeIssues.csv

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,6 @@
3737
"Microsoft.Azure.Commands.Network.dll","Microsoft.Azure.Commands.Network.StopAzureNetworkWatcherPacketCaptureCommand","Stop-AzureRmNetworkWatcherPacketCapture","0","2090","The ValidateNotNullOrEmpty attribute has been added to parameter 'NetworkWatcherName' for cmdlet 'Stop-AzureRmNetworkWatcherPacketCapture'.","Remove the ValidateNotNullOrEmpty attribute from parameter 'NetworkWatcherName'."
3838
"Microsoft.Azure.Commands.Network.dll","Microsoft.Azure.Commands.Network.StopAzureNetworkWatcherPacketCaptureCommand","Stop-AzureRmNetworkWatcherPacketCapture","0","2090","The ValidateNotNullOrEmpty attribute has been added to parameter 'ResourceGroupName' for cmdlet 'Stop-AzureRmNetworkWatcherPacketCapture'.","Remove the ValidateNotNullOrEmpty attribute from parameter 'ResourceGroupName'."
3939
"D:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.DataLakeAnalytics\Microsoft.Azure.Commands.DataLakeAnalytics.dll","Microsoft.Azure.Commands.DataLakeAnalytics.SubmitAzureDataLakeAnalyticsJob","Submit-AzureRmDataLakeAnalyticsJob","0","1050","The parameter set 'Submit job with script path for SQL-IP' for cmdlet 'Submit-AzureRmDataLakeAnalyticsJob' has been removed.","Add parameter set 'Submit job with script path for SQL-IP' back to cmdlet 'Submit-AzureRmDataLakeAnalyticsJob'."
40-
"D:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.DataLakeAnalytics\Microsoft.Azure.Commands.DataLakeAnalytics.dll","Microsoft.Azure.Commands.DataLakeAnalytics.SubmitAzureDataLakeAnalyticsJob","Submit-AzureRmDataLakeAnalyticsJob","0","1050","The parameter set 'Submit SQL-IP Job' for cmdlet 'Submit-AzureRmDataLakeAnalyticsJob' has been removed.","Add parameter set 'Submit SQL-IP Job' back to cmdlet 'Submit-AzureRmDataLakeAnalyticsJob'."
40+
"D:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.DataLakeAnalytics\Microsoft.Azure.Commands.DataLakeAnalytics.dll","Microsoft.Azure.Commands.DataLakeAnalytics.SubmitAzureDataLakeAnalyticsJob","Submit-AzureRmDataLakeAnalyticsJob","0","1050","The parameter set 'Submit SQL-IP Job' for cmdlet 'Submit-AzureRmDataLakeAnalyticsJob' has been removed.","Add parameter set 'Submit SQL-IP Job' back to cmdlet 'Submit-AzureRmDataLakeAnalyticsJob'."
41+
"Microsoft.Azure.Commands.Network.dll","Microsoft.Azure.Commands.Network.NewAzureRmIpsecPolicyCommand","New-AzureRmIpsecPolicy","0","2150","A validate range has been added for parameter 'SALifeTimeSeconds' for cmdlet 'New-AzureRmIpsecPolicy'.","Remove the validate range from parameter 'SALifeTimeSeconds'."
42+
"Microsoft.Azure.Commands.Network.dll","Microsoft.Azure.Commands.Network.NewAzureRmIpsecPolicyCommand","New-AzureRmIpsecPolicy","0","2150","A validate range has been added for parameter 'SADataSizeKilobytes' for cmdlet 'New-AzureRmIpsecPolicy'.","Remove the validate range from parameter 'SADataSizeKilobytes'."

0 commit comments

Comments
 (0)