Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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
6 changes: 6 additions & 0 deletions src/Network/Network.Test/ScenarioTests/CortexTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1095,6 +1095,12 @@ function Test-CortexExpressRouteCRUD
Assert-AreEqual "PolicyGroup2" $VpnServerConfig2.ConfigurationPolicyGroups[0].Name
Assert-AreEqual 0 $VpnServerConfig2.ConfigurationPolicyGroups[0].Priority

# Get AllVpnServerConfigurationRadiusServerSecret from VpnServerConfiguration
$vpnServerConfigRadiusAuthServers = Get-AllVpnServerConfigurationRadiusServerSecret -ResourceGroupName $rgname -Name $VpnServerConfiguration2Name
Assert-AreEqual 1 $vpnServerConfigRadiusAuthServers.Count
Assert-AreEqual "TestRadiusServer1" $vpnServerConfigRadiusAuthServers[0].RadiusServerAddress
Assert-AreEqual "TestRadiusServerPassword" $vpnServerConfigRadiusAuthServers[0].RadiusServerSecret

# Delete VpnServerConfiguration2 child PolicyGroup2 using Remove-AzVpnServerConfigurationPolicyGroup
$delete = Remove-AzVpnServerConfigurationPolicyGroup -ResourceGroupName $rgName -ServerConfigurationName $VpnServerConfiguration2Name -Name "PolicyGroup2" -Force -PassThru
Assert-AreEqual $True $delete
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,12 @@ param
$authTypes = $expected.VpnClientConfiguration.VpnAuthenticationTypes
Assert-NotNull $authTypes
Assert-AreEqual 3 @($authTypes).Count

# Get AllVirtualNetworkGatewayRadiusServerSecret from virtualnetworkgateway
$vngRadiusAuthServers = Get-AzAllVirtualNetworkGatewayRadiusServerSecret -ResourceGroupName $rgname -Name $rname
Assert-AreEqual 1 $vngRadiusAuthServers.Count
Assert-AreEqual "1.2.3.4" $vngRadiusAuthServers[0].RadiusServerAddress
Assert-AreEqual "radiuspd" $vngRadiusAuthServers[0].RadiusServerSecret

$radiusCertFilePath = $basedir + "\ScenarioTests\Data\ApplicationGatewayAuthCert.cer"
$vpnProfilePackageUrl = New-AzVpnClientConfiguration -ResourceGroupName $rgname -name $rname -AuthenticationMethod $vpnclientAuthMethod -RadiusRootCertificateFile $radiusCertFilePath
Expand Down Expand Up @@ -767,11 +773,25 @@ function Test-VirtualNetworkGatewayRadius
Assert-AreEqual $actual.VpnClientConfiguration.RadiusServers[1].RadiusServerAddress $radiusServer2.RadiusServerAddress
Assert-AreEqual $actual.VpnClientConfiguration.RadiusServers[1].RadiusServerScore $radiusServer2.RadiusServerScore

# Get AllVirtualNetworkGatewayRadiusServerSecret from virtualnetworkgateway
$vngRadiusAuthServers = Get-AzAllVirtualNetworkGatewayRadiusServerSecret -ResourceGroupName $rgname -Name $rname
Assert-AreEqual 2 $vngRadiusAuthServers.Count
Assert-AreEqual "10.1.0.1" $vngRadiusAuthServers[0].RadiusServerAddress
Assert-AreEqual "radiuspd" $vngRadiusAuthServers[0].RadiusServerSecret
Assert-AreEqual "10.1.0.1" $vngRadiusAuthServers[1].RadiusServerAddress
Assert-AreEqual "radiuspd" $vngRadiusAuthServers[1].RadiusServerSecret

# Update gateway to singular radius
Set-AzVirtualNetworkGateway -VirtualNetworkGateway $actual -VpnClientAddressPool 201.169.0.0/16 -VpnClientProtocol "IkeV2" -RadiusServerAddress 10.1.0.2 -RadiusServerSecret $radiuspd
$actual = Get-AzVirtualNetworkGateway -ResourceGroupName $rgname -name $rname
Assert-Null $actual.VpnClientConfiguration.RadiusServers
Assert-AreEqual $actual.VpnClientConfiguration.RadiusServerAddress 10.1.0.2

# Get AllVirtualNetworkGatewayRadiusServerSecret from virtualnetworkgateway
$vngRadiusAuthServers = Get-AzAllVirtualNetworkGatewayRadiusServerSecret -ResourceGroupName $rgname -Name $rname
Assert-AreEqual 1 $vngRadiusAuthServers.Count
Assert-AreEqual "10.1.0.2" $vngRadiusAuthServers[0].RadiusServerAddress
Assert-AreEqual "radiuspd" $vngRadiusAuthServers[0].RadiusServerSecret

# Update gateway radius settings
$radiusServers = @($radiusServer3, $radiusServer1)
Expand All @@ -782,7 +802,7 @@ function Test-VirtualNetworkGatewayRadius
Assert-AreEqual $actual.VpnClientConfiguration.RadiusServers[0].RadiusServerAddress $radiusServer3.RadiusServerAddress
Assert-AreEqual $actual.VpnClientConfiguration.RadiusServers[0].RadiusServerScore $radiusServer3.RadiusServerScore
Assert-AreEqual $actual.VpnClientConfiguration.RadiusServers[1].RadiusServerAddress $radiusServer1.RadiusServerAddress
Assert-AreEqual $actual.VpnClientConfiguration.RadiusServers[1].RadiusServerScore $radiusServer1.RadiusServerScore
Assert-AreEqual $actual.VpnClientConfiguration.RadiusServers[1].RadiusServerScore $radiusServer1.RadiusServerScoret
}
finally
{
Expand Down
2 changes: 2 additions & 0 deletions src/Network/Network/Az.Network.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ CmdletsToExport = 'Add-AzApplicationGatewayAuthenticationCertificate',
'Get-AzVirtualNetworkGatewayLearnedRoute',
'Get-AzVirtualNetworkGatewayNatRule',
'Get-AzVirtualNetworkGatewaySupportedVpnDevice',
'Get-AzAllVirtualNetworkGatewayRadiusServerSecret',
'Get-AzVirtualNetworkGatewayVpnClientConnectionHealth',
'Get-AzVirtualNetworkPeering', 'Get-AzVirtualNetworkSubnetConfig',
'Get-AzVirtualNetworkTap', 'Get-AzVirtualNetworkUsageList',
Expand All @@ -318,6 +319,7 @@ CmdletsToExport = 'Add-AzApplicationGatewayAuthenticationCertificate',
'Get-AzVpnClientRootCertificate', 'Get-AzVpnConnection',
'Get-AzVpnGateway', 'Get-AzVpnGatewayNatRule',
'Get-AzVpnServerConfiguration',
'Get-AzAllVpnServerConfigurationRadiusServerSecret',
'Get-AzVpnServerConfigurationPolicyGroup', 'Get-AzVpnSite',
'Get-AzVpnSiteLinkConnectionIkeSa',
'Invoke-AzFirewallPacketCapture',
Expand Down
2 changes: 2 additions & 0 deletions src/Network/Network/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
- `Add-AzApplicationGatewayBackendHttpSetting`
- `Set-AzApplicationGatewayBackendHttpSetting`
* Onboarded Maps to Private Link Common Cmdlets
* Added cmdlet 'Get-AzAllVirtualNetworkGatewayRadiusServerSecret' to fetch list of VirtualNetworkGateway PointToSiteConfiguration Radius servers and corresponding radius secrets.
* Added cmdlet 'Get-AzAllVpnServerConfigurationRadiusServerSecret ' to fetch list of VirtualWan VpnServerConfiguration Radius servers and corresponding radius secrets.

## Version 7.19.1
* Added a read-only property `ComputedDisabledRules` to `ApplicationGatewayFirewallPolicyManagedRuleSet`. This property shows which rules are effectively disabled, based on both user-defined WAF policy overrides and the default state of the rules in the managed ruleset.
Expand Down
2 changes: 2 additions & 0 deletions src/Network/Network/Common/NetworkResourceManagerProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1909,6 +1909,7 @@ private static void Initialize()
cfg.CreateMap<MNM.VpnServerConfigRadiusClientRootCertificate, CNM.PSClientCertificate>();
cfg.CreateMap<MNM.AadAuthenticationParameters, CNM.PSAadAuthenticationParameters>();
cfg.CreateMap<MNM.P2SVpnConnectionHealthRequest, CNM.PSP2SVpnConnectionHealthRequest>();
cfg.CreateMap<MNM.RadiusAuthServer, CNM.PSRadiusAuthServer>();

// CNM to MNM
cfg.CreateMap<CNM.PSP2SVpnGateway, MNM.P2SVpnGateway>();
Expand All @@ -1931,6 +1932,7 @@ private static void Initialize()
cfg.CreateMap<CNM.PSClientCertificate, MNM.VpnServerConfigRadiusClientRootCertificate>();
cfg.CreateMap<CNM.PSAadAuthenticationParameters, MNM.AadAuthenticationParameters>();
cfg.CreateMap<CNM.PSP2SVpnConnectionHealthRequest, MNM.P2SVpnConnectionHealthRequest>();
cfg.CreateMap<CNM.PSRadiusAuthServer, MNM.RadiusAuthServer>();

// SecurityPartnerProviders
// CNM to MNM
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------

namespace Microsoft.Azure.Commands.Network
{
using Microsoft.Azure.Commands.Network.Models;
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
using Microsoft.Azure.Management.Network;
using Microsoft.Azure.Management.Network.Models;
using System.Collections.Generic;
using System.Management.Automation;

[Cmdlet(VerbsCommon.Get,
ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "AllVpnServerConfigurationRadiusServerSecret"), OutputType(typeof(PSVpnServerConfiguration))]
public class GetAzAllVpnServerConfigurationRadiusServerSecretCommand : VpnServerConfigurationBaseCmdlet
{
[Alias("ResourceName", "VpnServerConfigurationName")]
[Parameter(
Mandatory = true,
ValueFromPipelineByPropertyName = true,
HelpMessage = "The resource name.")]
[ResourceNameCompleter("Microsoft.Network/vpnServerConfigurations", "ResourceGroupName")]
[ValidateNotNullOrEmpty]
[SupportsWildcards]
public virtual string Name { get; set; }

[Parameter(
Mandatory = true,
ValueFromPipelineByPropertyName = true,
HelpMessage = "The resource group name.")]
[ResourceGroupCompleter]
[ValidateNotNullOrEmpty]
[SupportsWildcards]
public virtual string ResourceGroupName { get; set; }

public override void Execute()
{
base.Execute();

List<PSRadiusAuthServer> radiusAuthServers = new List<PSRadiusAuthServer>();
foreach (var radiusAuthServer in this.VpnServerConfigurationClient.ListRadiusSecrets(this.ResourceGroupName, this.Name).Value)
{
radiusAuthServers.Add(NetworkResourceManagerProfile.Mapper.Map<PSRadiusAuthServer>(radiusAuthServer));
}

WriteObject(radiusAuthServers, true);
}
}
}
34 changes: 34 additions & 0 deletions src/Network/Network/Models/PSRadiusAuthServer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------
using Microsoft.WindowsAzure.Commands.Common.Attributes;
using Newtonsoft.Json;
using System.Collections.Generic;

namespace Microsoft.Azure.Commands.Network.Models
{
public class PSRadiusAuthServer
{
/// <summary>
/// RadiusServerAddress set on VirtualNetworkGateways's or VpnServerConfiguration
/// </summary>
[Ps1Xml(Target = ViewControl.Table)]
public string RadiusServerAddress { get; set; }

/// <summary>
/// RadiusServerSecret for respective RadiusServerAddress thats set on VirtualNetworkGateways's or VpnServerConfiguration
/// </summary>
[Ps1Xml(Target = ViewControl.Table)]
public string RadiusServerSecret { get; set; }
}
}
22 changes: 22 additions & 0 deletions src/Network/Network/Network.format.ps1xml
Original file line number Diff line number Diff line change
Expand Up @@ -7432,5 +7432,27 @@
</ListEntries>
</ListControl>
</View>
<View>
<Name>Microsoft.Azure.Commands.Network.Models.RadiusAuthServer</Name>
<ViewSelectedBy>
<TypeName>Microsoft.Azure.Commands.Network.Models.RadiusAuthServer</TypeName>
</ViewSelectedBy>
<ListControl>
<ListEntries>
<ListEntry>
<ListItems>
<ListItem>
<Label>RadiusServerAddress</Label>
<PropertyName>RadiusServerAddress</PropertyName>
</ListItem>
<ListItem>
<Label>RadiusServerSecret</Label>
<PropertyName>RadiusServerSecret</PropertyName>
</ListItem>
</ListItems>
</ListEntry>
</ListEntries>
</ListControl>
</View>
</ViewDefinitions>
</Configuration>
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Commands.Network.Models;
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
using Microsoft.Azure.Management.Network;
using System.Collections.Generic;
using System.Management.Automation;
using MNM = Microsoft.Azure.Commands.Network.Models;

namespace Microsoft.Azure.Commands.Network.VirtualNetworkGateway
{
[Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "AllVirtualNetworkGatewayRadiusServerSecret"), OutputType(typeof(MNM.PSRadiusAuthServer))]
public class GetAzAllVirtualNetworkGatewayRadiusServerSecretCommand : VirtualNetworkGatewayBaseCmdlet
{
[Alias("ResourceName")]
[Parameter(
Mandatory = true,
ValueFromPipelineByPropertyName = true,
HelpMessage = "The resource name.")]
[ResourceNameCompleter("Microsoft.Network/virtualNetworkGateways", "ResourceGroupName")]
[ValidateNotNullOrEmpty]
public virtual string Name { get; set; }

[Parameter(
Mandatory = true,
ValueFromPipelineByPropertyName = true,
HelpMessage = "The resource group name.")]
[ResourceGroupCompleter]
[ValidateNotNullOrEmpty]
public virtual string ResourceGroupName { get; set; }

public override void Execute()
{
base.Execute();

List<PSRadiusAuthServer> radiusAuthServers = new List<PSRadiusAuthServer>();
foreach (var radiusAuthServer in this.VirtualNetworkGatewayClient.ListRadiusSecrets(this.ResourceGroupName, this.Name).Value)
{
radiusAuthServers.Add(NetworkResourceManagerProfile.Mapper.Map<PSRadiusAuthServer>(radiusAuthServer));
}

WriteObject(radiusAuthServers, true);
}
}
}
Loading