Skip to content

Commit c08c9b9

Browse files
authored
Merge pull request #311 from Azure/ritwikbasu/public
Radius server configuration cmdlets
2 parents 69e474b + da5cf63 commit c08c9b9

27 files changed

+600464
-54
lines changed

src/ResourceManager/Network/AzureRM.Network.Netcore.psd1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,8 @@ CmdletsToExport = 'Add-AzureRmApplicationGatewayAuthenticationCertificate',
215215
'Remove-AzureRmVpnClientRootCertificate',
216216
'Set-AzureRmVirtualNetworkGatewayVpnClientConfig',
217217
'Get-AzureRmVpnClientPackage',
218+
'New-AzureRmVpnClientConfiguration',
219+
'Get-AzureRmVpnClientConfiguration',
218220
'New-AzureRmVirtualNetworkGatewayIpConfig',
219221
'Add-AzureRmVirtualNetworkGatewayIpConfig',
220222
'Remove-AzureRmVirtualNetworkGatewayIpConfig',

src/ResourceManager/Network/AzureRM.Network.psd1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,8 @@ CmdletsToExport = 'Add-AzureRmApplicationGatewayAuthenticationCertificate',
223223
'Remove-AzureRmVpnClientRootCertificate',
224224
'Set-AzureRmVirtualNetworkGatewayVpnClientConfig',
225225
'Get-AzureRmVpnClientPackage',
226+
'New-AzureRmVpnClientConfiguration',
227+
'Get-AzureRmVpnClientConfiguration',
226228
'New-AzureRmVirtualNetworkGatewayIpConfig',
227229
'Add-AzureRmVirtualNetworkGatewayIpConfig',
228230
'Remove-AzureRmVirtualNetworkGatewayIpConfig',

src/ResourceManager/Network/ChangeLog.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@
2424
- Updated Set-AzureRmVirtualSubnetConfig: Added optional parameter -ServiceEndpoint
2525
* Added cmdlet to list endpoint services available in the location
2626
- Get-AzureRmVirtualNetworkAvailableEndpointService
27+
* Added the ability to configure external radius based P2S authentication to the following commandlets
28+
- New-AzureVirtualNetworkGateway
29+
- Set-AzureVirtualNetworkGateway
30+
- Set-AzureRmVirtualNetworkGatewayVpnClientConfig
31+
* Added cmdlet to allow generation of VpnProfiles for external radius based P2S
32+
- New-AzureRmVpnClientConfiguration
33+
- Get-AzureRmVpnClientConfiguration
2734
* Added support for SKU parameter to Public IP Addresses and Load Balancers
2835
- Updated New-AzureRMLoadBalancer: Added optional parameter -Sku
2936
- Updated New-AzureRMPublicIpAddress: Added optional parameter -Sku

src/ResourceManager/Network/Commands.Network.Test/Commands.Network.Test.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,9 @@
539539
<None Include="SessionRecords\Commands.Network.Test.ScenarioTests.VirtualNetworkGatewayTests\TestVirtualNetworkGatewayCRUD.json">
540540
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
541541
</None>
542+
<None Include="SessionRecords\Commands.Network.Test.ScenarioTests.VirtualNetworkGatewayTests\TestVirtualNetworkGatewayP2SVpnProfile.json">
543+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
544+
</None>
542545
<None Include="SessionRecords\Commands.Network.Test.ScenarioTests.VirtualNetworkGatewayTests\VirtualNetworkGatewayActiveActiveFeatureTest.json">
543546
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
544547
</None>

src/ResourceManager/Network/Commands.Network.Test/ScenarioTests/VirtualNetworkGatewayTests.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15+
using System;
1516
using Microsoft.WindowsAzure.Commands.ScenarioTest;
1617
using Xunit;
1718

@@ -58,6 +59,13 @@ public void VirtualNetworkGatewayRouteApiTest()
5859
NetworkResourcesController.NewInstance.RunPsTest("Test-VirtualNetworkGatewayBgpRouteApi");
5960
}
6061

62+
[Fact()]
63+
public void TestVirtualNetworkGatewayP2SVpnProfile()
64+
{
65+
NetworkResourcesController.NewInstance.RunPsTest(string.Format(
66+
"Test-VirtualNetworkGatewayGenerateVpnProfile -baseDir '{0}'", AppDomain.CurrentDomain.BaseDirectory));
67+
}
68+
6169
[Fact]
6270
[Trait(Category.AcceptanceType, Category.CheckIn)]
6371
public void VirtualNetworkGatewayIkeV2Test()

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

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,69 @@ function Test-VirtualNetworkGatewayCRUD
147147
}
148148
}
149149

150+
<#
151+
.SYNOPSIS
152+
Virtual network gateway tests
153+
#>
154+
function Test-VirtualNetworkGatewayGenerateVpnProfile
155+
{
156+
param
157+
(
158+
$basedir = ".\"
159+
)
160+
161+
# Setup
162+
$rgname = Get-ResourceName
163+
$rname = Get-ResourceName
164+
$domainNameLabel = Get-ResourceName
165+
$vnetName = Get-ResourceName
166+
$publicIpName = Get-ResourceName
167+
$vnetGatewayConfigName = Get-ResourceName
168+
$rglocation = Get-ProviderLocation ResourceManagement
169+
$resourceTypeParent = "Microsoft.Network/virtualNetworkGateways"
170+
$location = Get-ProviderLocation $resourceTypeParent
171+
$vpnclientAuthMethod = "EAPTLS"
172+
173+
try
174+
{
175+
# Create the resource group
176+
$resourceGroup = New-AzureRmResourceGroup -Name $rgname -Location $rglocation -Tags @{ testtag = "testval" }
177+
178+
# Create the Virtual Network
179+
$subnet = New-AzureRmVirtualNetworkSubnetConfig -Name "GatewaySubnet" -AddressPrefix 10.0.0.0/24
180+
$vnet = New-AzureRmvirtualNetwork -Name $vnetName -ResourceGroupName $rgname -Location $location -AddressPrefix 10.0.0.0/16 -Subnet $subnet
181+
$vnet = Get-AzureRmvirtualNetwork -Name $vnetName -ResourceGroupName $rgname
182+
$subnet = Get-AzureRmVirtualNetworkSubnetConfig -Name "GatewaySubnet" -VirtualNetwork $vnet
183+
184+
# Create the publicip
185+
$publicip = New-AzureRmPublicIpAddress -ResourceGroupName $rgname -name $publicIpName -location $location -AllocationMethod Dynamic -DomainNameLabel $domainNameLabel
186+
187+
# Create & Get virtualnetworkgateway
188+
$vnetIpConfig = New-AzureRmVirtualNetworkGatewayIpConfig -Name $vnetGatewayConfigName -PublicIpAddress $publicip -Subnet $subnet
189+
$actual = New-AzureRmVirtualNetworkGateway -ResourceGroupName $rgname -name $rname -location $location -IpConfigurations $vnetIpConfig -GatewayType Vpn -VpnType RouteBased -EnableBgp $false -GatewaySku VpnGw2
190+
$expected = Get-AzureRmVirtualNetworkGateway -ResourceGroupName $rgname -name $rname
191+
Assert-AreEqual $expected.ResourceGroupName $actual.ResourceGroupName
192+
Assert-AreEqual $expected.Name $actual.Name
193+
#Assert-AreEqual "Vpn" $expected.GatewayType
194+
#Assert-AreEqual "RouteBased" $expected.VpnType
195+
196+
# Update P2S VPNClient Configuration
197+
$Secure_String_Pwd = ConvertTo-SecureString "TestRadiusServerPassword" -AsPlainText -Force
198+
Set-AzureRmVirtualNetworkGatewayVpnClientConfig -VirtualNetworkGateway $expected -VpnClientAddressPool 200.168.0.0/16 -RadiusServerAddress "TestRadiusServer" -RadiusServerSecret $Secure_String_Pwd
199+
$expected = Get-AzureRmVirtualNetworkGateway -ResourceGroupName $rgname -name $rname
200+
Assert-AreEqual "200.168.0.0/16" $expected.VpnClientConfiguration.VpnClientAddressPool.AddressPrefixes
201+
202+
$radiusCertFilePath = $basedir + "\ScenarioTests\Data\ApplicationGatewayAuthCert.cer"
203+
$vpnProfilePackageUrl = New-AzureRmVpnClientConfiguration -ResourceGroupName $rgname -name $rname -AuthenticationMethod $vpnclientAuthMethod -RadiusRootCertificateFile $radiusCertFilePath
204+
Write-Host $vpnProfilePackageUrl.VpnProfileSASUrl
205+
}
206+
finally
207+
{
208+
# Cleanup
209+
Clean-ResourceGroup $rgname
210+
}
211+
}
212+
150213
<#
151214
.SYNOPSIS
152215
Virtual network gateway tests

src/ResourceManager/Network/Commands.Network.Test/SessionRecords/Commands.Network.Test.ScenarioTests.VirtualNetworkGatewayTests/TestVirtualNetworkGatewayP2SVpnProfile.json

Lines changed: 598933 additions & 0 deletions
Large diffs are not rendered by default.

src/ResourceManager/Network/Commands.Network/Commands.Network.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@
330330
<Compile Include="Models\PSVirtualNetworkPeering.cs" />
331331
<Compile Include="Models\PSTunnelConnectionHealth.cs" />
332332
<Compile Include="Models\PSVirtualNetworkUsageCustom.cs" />
333+
<Compile Include="Models\PSVpnProfile.cs" />
333334
<Compile Include="NetworkInterface\EffectiveResources\GetAzureEffectiveNetworkSecurityGroupCommand.cs" />
334335
<Compile Include="NetworkInterface\EffectiveResources\GetAzureEffectiveRouteTableCommand.cs" />
335336
<Compile Include="NetworkInterface\IpConfiguration\AddAzureNetworkInterfaceIpConfigCommand.cs" />
@@ -376,6 +377,9 @@
376377
<Compile Include="VirtualNetworkGateway\GetAzureVirtualNetworkGatewayAdvertisedRouteCommand.cs" />
377378
<Compile Include="VirtualNetworkGateway\GetAzureVirtualNetworkGatewayBgpPeerStatus.cs" />
378379
<Compile Include="VirtualNetworkGateway\GetAzureVirtualNetworkGatewayLearnedRouteCommand.cs" />
380+
<Compile Include="VirtualNetworkGateway\GetAzureVpnClientConfigurationCommand.cs" />
381+
<Compile Include="VirtualNetworkGateway\NewAzureVpnClientConfigurationCommand.cs" />
382+
<Compile Include="VirtualNetworkGateway\VirtualNetworkGatewayParameterSets.cs" />
379383
<Compile Include="VirtualNetwork\TestAzurePrivateIPAddressAvailabilityCmdlet.cs" />
380384
<Compile Include="PublicIpAddress\GetAzurePublicIpAddressCommand.cs" />
381385
<Compile Include="PublicIpAddress\NewAzurePublicIpAddressCommand.cs" />

0 commit comments

Comments
 (0)