Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ public void VirtualNetworkGatewayIkeV2Test()
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
[Trait(Category.Owner, Category.brooklynft)]
public void VirtualNetworkGatewayOpenVPNTest()
{
NetworkResourcesController.NewInstance.RunPsTest("Test-VirtualNetworkGatewayOpenVPN");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void VirtualNetworkGatewayVpnCustomIpsecPolicySetTest()
{
NetworkResourcesController.NewInstance.RunPsTest("Test-VirtualNetworkGatewayVpnCustomIpsecPolicySet");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ function Test-VirtualNetworkGatewayBgpRouteApi

<#
.SYNOPSIS
Virtual network gateway BGP route API test
Virtual network gateway P2S API test
#>
function Test-VirtualNetworkGatewayIkeV2
{
Expand Down Expand Up @@ -619,6 +619,60 @@ function Test-VirtualNetworkGatewayIkeV2
}
}

<#
.SYNOPSIS
Virtual network gateway P2S OpenVPN API test
#>
function Test-VirtualNetworkGatewayOpenVPN
{
# Setup
$rgname = Get-ResourceGroupName
$rname = Get-ResourceName
$domainNameLabel = Get-ResourceName
$vnetName = Get-ResourceName
$publicIpName = Get-ResourceName
$vnetGatewayConfigName = Get-ResourceName
$rglocation = Get-ProviderLocation ResourceManagement
$resourceTypeParent = "Microsoft.Network/virtualNetworkGateways"
$location = Get-ProviderLocation $resourceTypeParent

try
{
# Create the resource group
$resourceGroup = New-AzureRmResourceGroup -Name $rgname -Location $rglocation -Tags @{ testtag = "testval" }

# create the client root cert
$clientRootCertName = "BrkLiteTestMSFTRootCA.cer"
#[SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine")]
$samplePublicCertData = "MIIDUzCCAj+gAwIBAgIQRgg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HBXbHr9U0NQigrJp5NphfuU5j81C8ixvfUdwyLmTv7rNA7GTAD";
$rootCert = New-AzureRmVpnClientRootCertificate -Name $clientRootCertName -PublicCertData $samplePublicCertData

# Create the Virtual Network
$subnet = New-AzureRmVirtualNetworkSubnetConfig -Name "GatewaySubnet" -AddressPrefix 10.0.0.0/24
$vnet = New-AzureRmvirtualNetwork -Name $vnetName -ResourceGroupName $rgname -Location $location -AddressPrefix 10.0.0.0/16 -Subnet $subnet
$vnet = Get-AzureRmvirtualNetwork -Name $vnetName -ResourceGroupName $rgname
$subnet = Get-AzureRmVirtualNetworkSubnetConfig -Name "GatewaySubnet" -VirtualNetwork $vnet

# Create the IP config
$publicip = New-AzureRmPublicIpAddress -ResourceGroupName $rgname -name $publicIpName -location $location -AllocationMethod Dynamic -DomainNameLabel $domainNameLabel
$vnetIpConfig = New-AzureRmVirtualNetworkGatewayIpConfig -Name $vnetGatewayConfigName -PublicIpAddress $publicip -Subnet $subnet

# Create & Get OpenVPN virtualnetworkgateway
New-AzureRmVirtualNetworkGateway -ResourceGroupName $rgname -name $rname -location $location -IpConfigurations $vnetIpConfig -GatewayType Vpn -VpnType RouteBased -EnableBgp $false -GatewaySku VpnGw1 -VpnClientAddressPool 201.169.0.0/16 -VpnClientRootCertificates $rootCert -VpnClientProtocol OpenVPN
$actual = Get-AzureRmVirtualNetworkGateway -ResourceGroupName $rgname -name $rname
Assert-AreEqual "VpnGw1" $actual.Sku.Tier
$protocols = $actual.VpnClientConfiguration.VpnClientProtocols
Assert-AreEqual 1 @($protocols).Count
Assert-AreEqual "OpenVPN" $protocols[0]
Assert-AreEqual "201.169.0.0/16" $actual.VpnClientConfiguration.VpnClientAddressPool.AddressPrefixes
}
finally
{
# Cleanup
Clean-ResourceGroup $rgname
}
}

<#
.SYNOPSIS
Virtual network gateway tests
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,9 @@ public class NewAzureVirtualNetworkGatewayCommand : VirtualNetworkGatewayBaseCmd
HelpMessage = "The list of P2S VPN client tunneling protocols")]
[ValidateSet(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change this from a ValidateSet to an ArgumentCompleter

MNM.VpnClientProtocol.SSTP,
MNM.VpnClientProtocol.IkeV2)]
MNM.VpnClientProtocol.IkeV2,
MNM.VpnClientProtocol.OpenVPN,
IgnoreCase = true)]
[ValidateNotNullOrEmpty]
public List<string> VpnClientProtocol { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ public class SetAzureVirtualNetworkGatewayCommand : VirtualNetworkGatewayBaseCmd
HelpMessage = "A list of P2S VPN client tunneling protocols")]
[ValidateSet(
MNM.VpnClientProtocol.SSTP,
MNM.VpnClientProtocol.IkeV2)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change this from a ValidateSet to an ArgumentCompleter

MNM.VpnClientProtocol.IkeV2,
MNM.VpnClientProtocol.OpenVPN,
IgnoreCase = true)]
[ValidateNotNullOrEmpty]
public List<string> VpnClientProtocol { get; set; }

Expand Down