Skip to content

Commit 1f76297

Browse files
author
Abhishek Shah
committed
Merge branch 'network-november' into vpn-ikesa
2 parents 6920cd4 + fa0dbb5 commit 1f76297

File tree

7 files changed

+65
-10
lines changed

7 files changed

+65
-10
lines changed

src/Network/Network.Test/ScenarioTests/CortexTests.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,14 +241,15 @@ function Test-CortexCRUD
241241
# Create the VpnConnection with site with links
242242
$natRule2 = Get-AzVpnGatewayNatRule -ResourceGroupName $rgName -ParentResourceName $vpnGatewayName -Name "NatRule2"
243243
$vpnSiteLinkConnection1 = New-AzVpnSiteLinkConnection -Name $vpnLink1ConnectionName -VpnSiteLink $vpnSite2.VpnSiteLinks[0] -ConnectionBandwidth 100 -EgressNatRule $natRule2
244-
$vpnSiteLinkConnection2 = New-AzVpnSiteLinkConnection -Name $vpnLink2ConnectionName -VpnSiteLink $vpnSite2.VpnSiteLinks[1] -ConnectionBandwidth 10
244+
$vpnSiteLinkConnection2 = New-AzVpnSiteLinkConnection -Name $vpnLink2ConnectionName -VpnSiteLink $vpnSite2.VpnSiteLinks[1] -ConnectionBandwidth 10 -VpnLinkConnectionMode "Default"
245245

246246
$createdVpnConnection2 = New-AzVpnConnection -ResourceGroupName $rgName -ParentResourceName $vpnGatewayName -Name $vpnConnection2Name -VpnSite $vpnSite2 -VpnSiteLinkConnection @($vpnSiteLinkConnection1, $vpnSiteLinkConnection2)
247247
$vpnConnection2 = Get-AzVpnConnection -ResourceGroupName $rgName -ParentResourceName $vpnGatewayName -Name $vpnConnection2Name
248248
Assert-AreEqual $vpnConnection2Name $vpnConnection2.Name
249249
Assert-AreEqual 2 $vpnConnection2.VpnLinkConnections.Count
250250
Assert-AreEqual 1 $vpnConnection2.VpnLinkConnections[0].EgressNatRules.Count
251251
Assert-AreEqual 0 $vpnConnection2.VpnLinkConnections[0].IngressNatRules.Count
252+
Assert-AreEqual "Default" $vpnConnection2.VpnLinkConnections[1].VpnLinkConnectionMode
252253

253254
$natRule2 = Get-AzVpnGatewayNatRule -ResourceGroupName $rgName -ParentResourceName $vpnGatewayName -Name "NatRule2"
254255
Assert-AreEqual 0 $natRule2.IngressVpnSiteLinkConnections.count

src/Network/Network/ChangeLog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
## Upcoming Release
2222
* Updated format list and format table views for Get-AzVirtualNetworkGatewayConnectionIkeSa
2323
* Updated `set-azExpressRouteGateway` to allow parameter -MinScaleUnits without specifying -MaxScaleUnits
24+
* Updated cmdlets to enable setting of VpnLinkConnectionMode on VpnSiteLinkConnections.
25+
- `New-AzVpnSiteLinkConnection`
26+
- `Update-AzVpnConnection`
2427
* Added new cmdlet to fetch IKE Security Associations for VPN Site Link Connections.
2528
- `Get-VpnSiteLinkConnectionIkeSa`
2629

src/Network/Network/Cortex/VpnConnection/NewAzVpnSiteLinkConnectionCommand.cs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System.Security;
88
using Microsoft.WindowsAzure.Commands.Common;
99
using System.Linq;
10+
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
1011

1112
[Cmdlet(
1213
VerbsCommon.New,
@@ -30,8 +31,8 @@ public class NewAzVpnSiteLinkConnectionCommand : NetworkBaseCmdlet
3031
public PSVpnSiteLink VpnSiteLink { get; set; }
3132

3233
[Parameter(
33-
Mandatory = false,
34-
HelpMessage = "The shared key required to set this link connection up.")]
34+
Mandatory = false,
35+
HelpMessage = "The shared key required to set this link connection up.")]
3536
[ValidateNotNullOrEmpty]
3637
public SecureString SharedKey { get; set; }
3738

@@ -51,8 +52,8 @@ public class NewAzVpnSiteLinkConnectionCommand : NetworkBaseCmdlet
5152
public PSIpsecPolicy IpSecPolicy { get; set; }
5253

5354
[Parameter(
54-
Mandatory = false,
55-
HelpMessage = "Gateway connection protocol:IKEv1/IKEv2")]
55+
Mandatory = false,
56+
HelpMessage = "Gateway connection protocol:IKEv1/IKEv2")]
5657
[ValidateSet(
5758
MNM.VirtualNetworkGatewayConnectionProtocol.IKEv1,
5859
MNM.VirtualNetworkGatewayConnectionProtocol.IKEv2,
@@ -84,6 +85,12 @@ public class NewAzVpnSiteLinkConnectionCommand : NetworkBaseCmdlet
8485
HelpMessage = "The list of egress NAT rules that are associated with this link Connection.")]
8586
public PSResourceId[] EgressNatRule { get; set; }
8687

88+
[Parameter(
89+
Mandatory = false,
90+
HelpMessage = "The connection mode for this link connection.")]
91+
[PSArgumentCompleter("Default", "ResponderOnly", "InitiatorOnly")]
92+
public string VpnLinkConnectionMode { get; set; }
93+
8794
public override void Execute()
8895
{
8996
base.Execute();
@@ -96,7 +103,8 @@ public override void Execute()
96103
UsePolicyBasedTrafficSelectors = this.UsePolicyBasedTrafficSelectors.IsPresent,
97104
RoutingWeight = Convert.ToInt32(this.RoutingWeight),
98105
IngressNatRules = IngressNatRule?.ToList(),
99-
EgressNatRules = EgressNatRule?.ToList()
106+
EgressNatRules = EgressNatRule?.ToList(),
107+
VpnLinkConnectionMode = this.VpnLinkConnectionMode
100108
};
101109

102110
if (this.VpnSiteLink == null)

src/Network/Network/Cortex/VpnConnection/UpdateAzureRmVpnConnectionCommand.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,12 @@ public class UpdateAzureRmVpnConnectionCommand : VpnConnectionBaseCmdlet
124124
HelpMessage = "The routing configuration for this vpn connection")]
125125
public PSRoutingConfiguration RoutingConfiguration { get; set; }
126126

127+
[Parameter(
128+
Mandatory = false,
129+
HelpMessage = "The connection mode for the link connections.")]
130+
[PSArgumentCompleter("Default", "ResponderOnly", "InitiatorOnly")]
131+
public string VpnLinkConnectionMode { get; set; }
132+
127133
[Parameter(
128134
Mandatory = false,
129135
HelpMessage = "Run cmdlet in the background")]
@@ -231,6 +237,14 @@ public override void Execute()
231237
vpnConnectionToModify.RoutingConfiguration = RoutingConfiguration;
232238
}
233239

240+
if(!String.IsNullOrEmpty(this.VpnLinkConnectionMode))
241+
{
242+
foreach(var vpnSiteLinkConnection in vpnConnectionToModify.VpnLinkConnections)
243+
{
244+
vpnSiteLinkConnection.VpnLinkConnectionMode = this.VpnLinkConnectionMode;
245+
}
246+
}
247+
234248
ConfirmAction(
235249
Properties.Resources.SettingResourceMessage,
236250
this.Name,

src/Network/Network/Models/Cortex/PSVpnSiteLinkConnection.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ public class PSVpnSiteLinkConnection : PSChildResource
4949
[Ps1Xml(Label = "EgressNatRules", Target = ViewControl.Table)]
5050
public List<PSResourceId> EgressNatRules { get; set; }
5151

52+
[Ps1Xml(Label = "VpnLinkConnectionMode", Target = ViewControl.Table)]
53+
public string VpnLinkConnectionMode { get; set; }
54+
5255
[JsonIgnore]
5356
public string IngressNatRulesText
5457
{

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Creates an Azure VpnSiteLinkConnection object.
1616
New-AzVpnSiteLinkConnection -Name <String> -VpnSiteLink <PSVpnSiteLink> [-SharedKey <SecureString>]
1717
[-ConnectionBandwidth <UInt32>] [-RoutingWeight <UInt32>] [-IpSecPolicy <PSIpsecPolicy>]
1818
[-VpnConnectionProtocolType <String>] [-EnableBgp] [-UseLocalAzureIpAddress] [-UsePolicyBasedTrafficSelectors]
19-
[-IngressNatRule <PSResourceId[]>] [-EgressNatRule <PSResourceId[]>]
19+
[-IngressNatRule <PSResourceId[]>] [-EgressNatRule <PSResourceId[]>] [-VpnLinkConnectionMode <String>]
2020
[-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
2121
```
2222

@@ -233,6 +233,19 @@ Accept pipeline input: False
233233
Accept wildcard characters: False
234234
```
235235
236+
### -VpnLinkConnectionMode
237+
The connection mode for this link connection.
238+
239+
```yaml
240+
Type: System.String
241+
Parameter Sets: (All)
242+
Aliases:
243+
Required: False
244+
Position: Named
245+
Default value: Default
246+
Accept wildcard characters: False
247+
```
248+
236249
### -VpnSiteLink
237250
The vpn site link object to connect to.
238251

src/Network/Network/help/Update-AzVpnConnection.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Updates a VPN connection.
1717
Update-AzVpnConnection -ResourceGroupName <String> -ParentResourceName <String> -Name <String>
1818
[-SharedKey <SecureString>] [-ConnectionBandwidthInMbps <UInt32>] [-IpSecPolicy <PSIpsecPolicy>]
1919
[-EnableBgp <Boolean>] [-UseLocalAzureIpAddress <Boolean>] [-UsePolicyBasedTrafficSelectors <Boolean>]
20-
[-VpnSiteLinkConnection <PSVpnSiteLinkConnection[]>] [-EnableInternetSecurity <Boolean>] [-RoutingConfiguration <PSRoutingConfiguration>] [-AsJob]
20+
[-VpnSiteLinkConnection <PSVpnSiteLinkConnection[]>] [-EnableInternetSecurity <Boolean>] [-RoutingConfiguration <PSRoutingConfiguration>] [-VpnLinkConnectionMode <String>] [-AsJob]
2121
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
2222
```
2323

@@ -26,7 +26,7 @@ Update-AzVpnConnection -ResourceGroupName <String> -ParentResourceName <String>
2626
Update-AzVpnConnection -ResourceId <String> [-SharedKey <SecureString>] [-ConnectionBandwidthInMbps <UInt32>]
2727
[-IpSecPolicy <PSIpsecPolicy>] [-EnableBgp <Boolean>] [-UseLocalAzureIpAddress <Boolean>]
2828
[-UsePolicyBasedTrafficSelectors <Boolean>] [-VpnSiteLinkConnection <PSVpnSiteLinkConnection[]>]
29-
[-EnableInternetSecurity <Boolean>] [-RoutingConfiguration <PSRoutingConfiguration>] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm]
29+
[-EnableInternetSecurity <Boolean>] [-RoutingConfiguration <PSRoutingConfiguration>] [-VpnLinkConnectionMode <String>] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm]
3030
[<CommonParameters>]
3131
```
3232

@@ -35,7 +35,7 @@ Update-AzVpnConnection -ResourceId <String> [-SharedKey <SecureString>] [-Connec
3535
Update-AzVpnConnection -InputObject <PSVpnConnection> [-SharedKey <SecureString>]
3636
[-ConnectionBandwidthInMbps <UInt32>] [-IpSecPolicy <PSIpsecPolicy>] [-EnableBgp <Boolean>]
3737
[-UseLocalAzureIpAddress <Boolean>] [-UsePolicyBasedTrafficSelectors <Boolean>]
38-
[-VpnSiteLinkConnection <PSVpnSiteLinkConnection[]>] [-EnableInternetSecurity <Boolean>] [-RoutingConfiguration <PSRoutingConfiguration>] [-AsJob]
38+
[-VpnSiteLinkConnection <PSVpnSiteLinkConnection[]>] [-EnableInternetSecurity <Boolean>] [-RoutingConfiguration <PSRoutingConfiguration>] [-VpnLinkConnectionMode <String>] [-AsJob]
3939
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
4040
```
4141

@@ -397,6 +397,19 @@ Accept pipeline input: False
397397
Accept wildcard characters: False
398398
```
399399
400+
### -VpnLinkConnectionMode
401+
The connection mode for all VpnSiteLinkConnections in this VpnConnection
402+
403+
```yaml
404+
Type: System.String
405+
Parameter Sets: (All)
406+
Aliases:
407+
Required: False
408+
Position: Named
409+
Default value: Default
410+
Accept wildcard characters: False
411+
```
412+
400413
### -Confirm
401414
Prompts you for confirmation before running the cmdlet.
402415

0 commit comments

Comments
 (0)