Skip to content

Commit fb7af0b

Browse files
authored
Merge pull request Azure#9582 from ritwikbasu/master
Add ConnectionProtocol as settable parameter for New-AzVirtualNetwork…
2 parents 01aaef4 + 19ce81c commit fb7af0b

File tree

6 files changed

+4207
-2837
lines changed

6 files changed

+4207
-2837
lines changed

ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#### Az.Network
3636
* Added 'RoutingPreference' to public ip tags
3737
* Improve examples for 'Get-AzNetworkServiceTag' reference documentation
38+
* Add ConnectionProtocolType (Ikev1/Ikev2) as a configurable parameter for New-AzVirtualNetworkGatewayConnection
3839

3940
#### Az.PolicyInsights
4041
* Fix null reference issue in Get-AzPolicyState

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,12 +364,13 @@ function Test-VirtualNetworkGatewayConnectionCRUD
364364
$localnetGateway.Location = $location
365365

366366
# Create & Get VirtualNetworkGatewayConnection
367-
$actual = New-AzVirtualNetworkGatewayConnection -ResourceGroupName $rgname -name $vnetConnectionName -location $location -VirtualNetworkGateway1 $vnetGateway -LocalNetworkGateway2 $localnetGateway -ConnectionType IPsec -RoutingWeight 3 -SharedKey abc
367+
$actual = New-AzVirtualNetworkGatewayConnection -ResourceGroupName $rgname -name $vnetConnectionName -location $location -VirtualNetworkGateway1 $vnetGateway -LocalNetworkGateway2 $localnetGateway -ConnectionType IPsec -RoutingWeight 3 -SharedKey abc -ConnectionProtocol IKEv1
368368
$expected = Get-AzVirtualNetworkGatewayConnection -ResourceGroupName $rgname -name $vnetConnectionName
369369
Assert-AreEqual $expected.ResourceGroupName $actual.ResourceGroupName
370370
Assert-AreEqual $expected.Name $actual.Name
371371
Assert-AreEqual "IPsec" $expected.ConnectionType
372372
Assert-AreEqual "3" $expected.RoutingWeight
373+
Assert-AreEqual "IKEv1" $expected.ConnectionProtocol
373374
#Assert-AreEqual "abc" $expected.SharedKey
374375

375376
# List VirtualNetworkGatewayConnections

src/Network/Network.Test/SessionRecords/Commands.Network.Test.ScenarioTests.VirtualNetworkGatewayConnectionTests/TestVirtualNetworkGatewayConnectionCRUD.json

Lines changed: 4169 additions & 2834 deletions
Large diffs are not rendered by default.

src/Network/Network/Models/PSVirtualNetworkGatewayConnection.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ public class PSVirtualNetworkGatewayConnection : PSTopLevelResource
6161

6262
public bool ExpressRouteGatewayBypass { get; set; }
6363

64+
[Ps1Xml(Target = ViewControl.Table)]
65+
public string ConnectionProtocol { get; set; }
66+
6467
[JsonIgnore]
6568
public string VirtualNetworkGateway1Text
6669
{

src/Network/Network/VirtualNetworkGatewayConnection/NewAzureVirtualNetworkGatewayConnectionCommand.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,15 @@ public class NewAzureVirtualNetworkGatewayConnectionCommand : VirtualNetworkGate
144144
HelpMessage = "A list of IPSec policies.")]
145145
public PSIpsecPolicy[] IpsecPolicies { get; set; }
146146

147+
[Parameter(
148+
Mandatory = false,
149+
HelpMessage = "Gateway connection protocol:IKEv1/IKEv2")]
150+
[ValidateSet(
151+
MNM.VirtualNetworkGatewayConnectionProtocol.IKEv1,
152+
MNM.VirtualNetworkGatewayConnectionProtocol.IKEv2,
153+
IgnoreCase = true)]
154+
public string ConnectionProtocol { get; set; }
155+
147156
[Parameter(Mandatory = false, HelpMessage = "Run cmdlet in the background")]
148157
public SwitchParameter AsJob { get; set; }
149158

@@ -186,6 +195,11 @@ private PSVirtualNetworkGatewayConnection CreateVirtualNetworkGatewayConnection(
186195
vnetGatewayConnection.UsePolicyBasedTrafficSelectors = this.UsePolicyBasedTrafficSelectors;
187196
vnetGatewayConnection.ExpressRouteGatewayBypass = this.ExpressRouteGatewayBypass.IsPresent;
188197

198+
if (!string.IsNullOrWhiteSpace(this.ConnectionProtocol))
199+
{
200+
vnetGatewayConnection.ConnectionProtocol = this.ConnectionProtocol;
201+
}
202+
189203
if (!string.IsNullOrEmpty(this.AuthorizationKey))
190204
{
191205
vnetGatewayConnection.AuthorizationKey = this.AuthorizationKey;

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

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ New-AzVirtualNetworkGatewayConnection -Name <String> -ResourceGroupName <String>
2020
[-VirtualNetworkGateway2 <PSVirtualNetworkGateway>] [-LocalNetworkGateway2 <PSLocalNetworkGateway>]
2121
-ConnectionType <String> [-RoutingWeight <Int32>] [-SharedKey <String>] [-Peer <PSPeering>]
2222
[-EnableBgp <Boolean>] [-Tag <Hashtable>] [-Force] [-UsePolicyBasedTrafficSelectors <Boolean>]
23-
[-IpsecPolicies <PSIpsecPolicy[]>] [-AsJob] [-ExpressRouteGatewayBypass]
23+
[-IpsecPolicies <PSIpsecPolicy[]>] [-ConnectionProtocol <String>] [-AsJob] [-ExpressRouteGatewayBypass]
2424
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
2525
```
2626

@@ -31,7 +31,7 @@ New-AzVirtualNetworkGatewayConnection -Name <String> -ResourceGroupName <String>
3131
[-VirtualNetworkGateway2 <PSVirtualNetworkGateway>] [-LocalNetworkGateway2 <PSLocalNetworkGateway>]
3232
-ConnectionType <String> [-RoutingWeight <Int32>] [-SharedKey <String>] [-PeerId <String>]
3333
[-EnableBgp <Boolean>] [-Tag <Hashtable>] [-Force] [-UsePolicyBasedTrafficSelectors <Boolean>]
34-
[-IpsecPolicies <PSIpsecPolicy[]>] [-AsJob] [-ExpressRouteGatewayBypass]
34+
[-IpsecPolicies <PSIpsecPolicy[]>] [-ConnectionProtocol <String>] [-AsJob] [-ExpressRouteGatewayBypass]
3535
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
3636
```
3737

@@ -76,6 +76,22 @@ Accept pipeline input: True (ByPropertyName)
7676
Accept wildcard characters: False
7777
```
7878
79+
### -ConnectionProtocol
80+
Gateway connection protocol:IKEv1/IKEv2
81+
82+
```yaml
83+
Type: System.String
84+
Parameter Sets: (All)
85+
Aliases:
86+
Accepted values: IKEv1, IKEv2
87+
88+
Required: False
89+
Position: Named
90+
Default value: None
91+
Accept pipeline input: False
92+
Accept wildcard characters: False
93+
```
94+
7995
### -ConnectionType
8096
8197
```yaml

0 commit comments

Comments
 (0)