Skip to content

Commit 0c7a77f

Browse files
authored
Merge branch 'preview' into preview
2 parents 6379e09 + 421e69e commit 0c7a77f

File tree

31 files changed

+779119
-263
lines changed

31 files changed

+779119
-263
lines changed

src/Common/Commands.Common/AzurePSCmdlet.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ protected override void ProcessRecord()
671671
base.ProcessRecord();
672672
ExecuteCmdlet();
673673
}
674-
catch (Exception ex)
674+
catch (Exception ex) when (!IsTerminatingError(ex))
675675
{
676676
WriteExceptionError(ex);
677677
}
@@ -697,5 +697,16 @@ public void Dispose()
697697
Dispose(true);
698698
GC.SuppressFinalize(this);
699699
}
700+
701+
public virtual bool IsTerminatingError(Exception ex)
702+
{
703+
var pipelineStoppedEx = ex as PipelineStoppedException;
704+
if (pipelineStoppedEx != null && pipelineStoppedEx.InnerException == null)
705+
{
706+
return true;
707+
}
708+
709+
return false;
710+
}
700711
}
701712
}

src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/Commands.ScenarioTests.ResourceManager.Common.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
<HintPath>..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.28.3\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll</HintPath>
7474
</Reference>
7575
<Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
76-
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.2.3.5\lib\net45\Microsoft.Rest.ClientRuntime.dll</HintPath>
76+
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.2.3.8\lib\net452\Microsoft.Rest.ClientRuntime.dll</HintPath>
7777
<Private>True</Private>
7878
</Reference>
7979
<Reference Include="Microsoft.Rest.ClientRuntime.Azure, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">

src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net45" />
1212
<package id="Microsoft.IdentityModel.Clients.ActiveDirectory" version="2.28.3" targetFramework="net45" />
1313
<package id="Microsoft.Net.Http" version="2.2.28" targetFramework="net45" />
14-
<package id="Microsoft.Rest.ClientRuntime" version="2.3.5" targetFramework="net45" />
14+
<package id="Microsoft.Rest.ClientRuntime" version="2.3.8" targetFramework="net452" />
1515
<package id="Microsoft.Rest.ClientRuntime.Azure" version="3.3.5" targetFramework="net45" />
1616
<package id="Microsoft.Rest.ClientRuntime.Azure.Authentication" version="2.2.9-preview" targetFramework="net45" />
1717
<package id="Microsoft.WindowsAzure.Management" version="4.1.1" targetFramework="net45" />

src/ResourceManager/Compute/Commands.Compute/Extension/AzureDiskEncryption/Scripts/AzureDiskEncryptionPreRequisiteSetup.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Param(
3838
)
3939

4040
$VerbosePreference = "Continue"
41-
$ErrorActionPreference = Stop
41+
$ErrorActionPreference = "Stop"
4242

4343
########################################################################################################################
4444
# Section1: Log-in to Azure and select appropriate subscription.

src/ResourceManager/Compute/Commands.Compute/help/Remove-AzureRmVMDscExtension.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ The **Remove-AzureRmVMDscExtension** cmdlet removes a Desired State Configuratio
2424

2525
### Example 1: Remove a DSC extension
2626
```
27-
PS C:\> Remove-AzureRmVMDscExtension -ResouceGroupName "ResourceGroup001" -VMName "VM07" -Name "DSC"
27+
PS C:\> Remove-AzureRmVMDscExtension -ResourceGroupName "ResourceGroup001" -VMName "VM07" -Name "DSC"
2828
```
2929

3030
This command removes the extension named DSC on virtual machine named VM07.

src/ResourceManager/HDInsight/Commands.HDInsight.Test/Commands.HDInsight.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
</Reference>
5757
<Reference Include="Microsoft.Azure.Management.HDInsight.Job">
5858
<SpecificVersion>False</SpecificVersion>
59-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.HDInsight.Job.2.0.3\lib\net40\Microsoft.Azure.Management.HDInsight.Job.dll</HintPath>
59+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.HDInsight.Job.2.0.4\lib\net40\Microsoft.Azure.Management.HDInsight.Job.dll</HintPath>
6060
</Reference>
6161
<Reference Include="Microsoft.Azure.Management.Storage">
6262
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Storage.2.4.0-preview\lib\net40\Microsoft.Azure.Management.Storage.dll</HintPath>

src/ResourceManager/HDInsight/Commands.HDInsight.Test/HDInsightTestBase.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ public virtual void SetupManagementClientForJobTests()
8585
.Verifiable();
8686

8787
var configurationResponse = new Dictionary<string, string>();
88+
configurationResponse.Add("fs.defaultFS", "wasb://[email protected]");
89+
configurationResponse.Add("fs.azure.account.key.xyz.blob.core.windows.net", "tempkey");
8890

8991
hdinsightManagementMock.Setup(c => c.GetClusterConfigurations(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>()))
9092
.Returns(configurationResponse)

src/ResourceManager/HDInsight/Commands.HDInsight.Test/UnitTests/JobTests.cs

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
using Microsoft.WindowsAzure.Commands.ScenarioTest;
2626
using Moq;
2727
using Xunit;
28+
using System.IO;
29+
using System.Text;
2830

2931
namespace Microsoft.Azure.Commands.HDInsight.Test
3032
{
@@ -228,6 +230,34 @@ public void GetJobWithIdProvided()
228230
f.WriteObject(It.Is<AzureHDInsightJob>(job => job.JobId.Equals(jobId))));
229231
}
230232

233+
[Fact]
234+
[Trait(Category.AcceptanceType, Category.CheckIn)]
235+
public void GetJobOutput()
236+
{
237+
string sampleOutput = "1";
238+
// Update HDInsight Management properties for Job.
239+
SetupManagementClientForJobTests();
240+
var jobId = "jobid_1984120_001";
241+
var cmdlet = GetJobOutputCommandDefinition();
242+
cmdlet.JobId = jobId;
243+
244+
MemoryStream jobOutput = new MemoryStream(Encoding.UTF8.GetBytes(sampleOutput));
245+
246+
var reader = new StreamReader(jobOutput);
247+
var text = reader.ReadToEnd();
248+
jobOutput.Seek(0, SeekOrigin.Begin);
249+
250+
hdinsightJobManagementMock.Setup(c => c.GetJobOutput(It.IsAny<string>(),It.IsAny<IStorageAccess>()))
251+
.Returns(jobOutput)
252+
.Verifiable();
253+
254+
cmdlet.ExecuteCmdlet();
255+
commandRuntimeMock.VerifyAll();
256+
commandRuntimeMock.Verify(
257+
f =>
258+
f.WriteObject(It.Is<string>(Output => Output.Equals(text))));
259+
}
260+
231261
[Fact]
232262
[Trait(Category.AcceptanceType, Category.CheckIn)]
233263
public void ListJobs()
@@ -383,6 +413,20 @@ public GetAzureHDInsightJobCommand GetJobCommandDefinition()
383413
return cmdlet;
384414
}
385415

416+
public GetAzureHDInsightJobOutputCommand GetJobOutputCommandDefinition()
417+
{
418+
var cmdlet = new GetAzureHDInsightJobOutputCommand
419+
{
420+
CommandRuntime = commandRuntimeMock.Object,
421+
HDInsightJobClient = hdinsightJobManagementMock.Object,
422+
HDInsightManagementClient = hdinsightManagementMock.Object,
423+
HttpCredential = new PSCredential("httpuser", string.Format("Password1!").ConvertToSecureString()),
424+
ClusterName = ClusterName
425+
};
426+
427+
return cmdlet;
428+
}
429+
386430
[Fact]
387431
[Trait(Category.AcceptanceType, Category.CheckIn)]
388432
public void WaitForJobCompletion_Sucess()

src/ResourceManager/HDInsight/Commands.HDInsight.Test/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<package id="Microsoft.Azure.KeyVault.Core" version="1.0.0" targetFramework="net45" />
88
<package id="Microsoft.Azure.Management.Authorization" version="0.18.2-preview" targetFramework="net45" />
99
<package id="Microsoft.Azure.Management.HDInsight" version="2.0.7" targetFramework="net45" />
10-
<package id="Microsoft.Azure.Management.HDInsight.Job" version="2.0.3" targetFramework="net45" />
10+
<package id="Microsoft.Azure.Management.HDInsight.Job" version="2.0.4" targetFramework="net45" />
1111
<package id="Microsoft.Azure.Management.Resources" version="2.20.0-preview" targetFramework="net45" />
1212
<package id="Microsoft.Azure.Management.Storage" version="2.4.0-preview" targetFramework="net45" />
1313
<package id="Microsoft.Azure.Test.Framework" version="1.0.6179.26854-prerelease" targetFramework="net45" />

src/ResourceManager/HDInsight/Commands.HDInsight/Commands.HDInsight.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
</Reference>
130130
<Reference Include="Microsoft.Azure.Management.HDInsight.Job">
131131
<SpecificVersion>False</SpecificVersion>
132-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.HDInsight.Job.2.0.3\lib\net40\Microsoft.Azure.Management.HDInsight.Job.dll</HintPath>
132+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.HDInsight.Job.2.0.4\lib\net40\Microsoft.Azure.Management.HDInsight.Job.dll</HintPath>
133133
</Reference>
134134
<Reference Include="Microsoft.WindowsAzure.Storage">
135135
<SpecificVersion>False</SpecificVersion>

src/ResourceManager/HDInsight/Commands.HDInsight/JobCommands/GetAzureHDInsightJobOutputCommand.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ private static string Convert(Stream stream)
133133

134134
internal IStorageAccess GetDefaultStorageAccess(string resourceGroupName, string clusterName)
135135
{
136+
var StorageAccountSuffix = "";
137+
136138
if (DefaultContainer == null && DefaultStorageAccountName == null && DefaultStorageAccountKey == null)
137139
{
138140
var DefaultStorageAccount = GetDefaultStorageAccount(resourceGroupName, clusterName);
@@ -143,6 +145,7 @@ internal IStorageAccess GetDefaultStorageAccess(string resourceGroupName, string
143145
DefaultContainer = wasbAccount.StorageContainerName;
144146
DefaultStorageAccountName = wasbAccount.StorageAccountName;
145147
DefaultStorageAccountKey = wasbAccount.StorageAccountKey;
148+
StorageAccountSuffix = DefaultContext.Environment.StorageEndpointSuffix;
146149
}
147150
else
148151
{
@@ -151,7 +154,7 @@ internal IStorageAccess GetDefaultStorageAccess(string resourceGroupName, string
151154

152155
}
153156

154-
return new AzureStorageAccess(DefaultStorageAccountName, DefaultStorageAccountKey, DefaultContainer);
157+
return new AzureStorageAccess(DefaultStorageAccountName, DefaultStorageAccountKey, DefaultContainer,StorageAccountSuffix);
155158
}
156159
}
157160
}

src/ResourceManager/HDInsight/Commands.HDInsight/Models/Job/AzureHdInsightJobManagementClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public void StopJob(string jobId)
141141
HdInsightJobManagementClient.JobManagement.KillJob(jobId);
142142
}
143143

144-
public Stream GetJobOutput(string jobid, IStorageAccess storageAccess)
144+
public virtual Stream GetJobOutput(string jobid, IStorageAccess storageAccess)
145145
{
146146
var joboutput = HdInsightJobManagementClient.JobManagement.GetJobOutput(jobid, storageAccess);
147147
return joboutput;

src/ResourceManager/HDInsight/Commands.HDInsight/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
<packages>
33
<package id="Microsoft.Azure.KeyVault.Core" version="1.0.0" targetFramework="net45" />
44
<package id="Microsoft.Azure.Management.HDInsight" version="2.0.7" targetFramework="net45" />
5-
<package id="Microsoft.Azure.Management.HDInsight.Job" version="2.0.3" targetFramework="net45" />
5+
<package id="Microsoft.Azure.Management.HDInsight.Job" version="2.0.4" targetFramework="net45" />
66
<package id="WindowsAzure.Storage" version="6.0.0" targetFramework="net45" />
77
</packages>

src/ResourceManager/Network/ChangeLog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@
3939
- Updated Add-AzureRMLoadBalancerRuleConfig: Added optional parameter DisableOutboundSNAT
4040
- Updated Set-AzureRMLoadBalancerRuleConfig: Added optional parameter DisableOutboundSNAT
4141

42+
## Version 4.3.2
43+
* New-AzureRmVirtualNetworkGateway: Added IkeV2 P2S support. New optional parameter added
44+
- VpnClientProtocol
45+
* Set-AzureRmVirtualNetworkGateway: Added IkeV2 P2S support. New optional parameter added
46+
- VpnClientProtocol
47+
4248
## Version 4.3.1
4349

4450
## Version 4.3.0

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,9 @@
523523
<None Include="SessionRecords\Commands.Network.Test.ScenarioTests.VirtualNetworkGatewayConnectionTests\TestVirtualNetworkGatewayConnectionWithActiveAcitveGateway.json">
524524
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
525525
</None>
526+
<None Include="SessionRecords\Commands.Network.Test.ScenarioTests.VirtualNetworkGatewayTests\VirtualNetworkGatewayIkeV2Test.json">
527+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
528+
</None>
526529
<None Include="SessionRecords\Commands.Network.Test.ScenarioTests.VirtualNetworkGatewayTests\VirtualNetworkGatewayRouteApiTest.json">
527530
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
528531
</None>

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ public void VirtualNetworkGatewayRouteApiTest()
6363
public void TestVirtualNetworkGatewayP2SVpnProfile()
6464
{
6565
NetworkResourcesController.NewInstance.RunPsTest(string.Format("Test-VirtualNetworkGatewayGenerateVpnProfile -baseDir '{0}'", AppDomain.CurrentDomain.BaseDirectory));
66+
67+
[Fact]
68+
[Trait(Category.AcceptanceType, Category.CheckIn)]
69+
public void VirtualNetworkGatewayIkeV2Test()
70+
{
71+
NetworkResourcesController.NewInstance.RunPsTest("Test-VirtualNetworkGatewayIkeV2");
6672
}
6773
}
6874
}

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

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,4 +548,66 @@ function Test-VirtualNetworkGatewayBgpRouteApi
548548
{
549549
Clean-ResourceGroup $rgname
550550
}
551-
}
551+
}
552+
553+
<#
554+
.SYNOPSIS
555+
Virtual network gateway BGP route API test
556+
#>
557+
function Test-VirtualNetworkGatewayIkeV2
558+
{
559+
# Setup
560+
$rgname = Get-ResourceGroupName
561+
$rname = Get-ResourceName
562+
$domainNameLabel = Get-ResourceName
563+
$vnetName = Get-ResourceName
564+
$publicIpName = Get-ResourceName
565+
$vnetGatewayConfigName = Get-ResourceName
566+
$rglocation = Get-ProviderLocation ResourceManagement
567+
$resourceTypeParent = "Microsoft.Network/virtualNetworkGateways"
568+
$location = Get-ProviderLocation $resourceTypeParent
569+
570+
try
571+
{
572+
# Create the resource group
573+
$resourceGroup = New-AzureRmResourceGroup -Name $rgname -Location $rglocation -Tags @{ testtag = "testval" }
574+
575+
# create the client root cert
576+
$clientRootCertName = "BrkLiteTestMSFTRootCA.cer"
577+
#[SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine")]
578+
$samplePublicCertData = "MIIDUzCCAj+gAwIBAgIQRggGmrpGj4pCblTanQRNUjAJBgUrDgMCHQUAMDQxEjAQBgNVBAoTCU1pY3Jvc29mdDEeMBwGA1UEAxMVQnJrIExpdGUgVGVzdCBSb290IENBMB4XDTEzMDExOTAwMjQxOFoXDTIxMDExOTAwMjQxN1owNDESMBAGA1UEChMJTWljcm9zb2Z0MR4wHAYDVQQDExVCcmsgTGl0ZSBUZXN0IFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC7SmE+iPULK0Rs7mQBO/6a6B6/G9BaMxHgDGzAmSG0Qsyt5e08aqgFnPdkMl3zRJw3lPKGha/JCvHRNrO8UpeAfc4IXWaqxx2iBipHjwmHPHh7+VB8lU0EJcUe7WBAI2n/sgfCwc+xKtuyRVlOhT6qw/nAi8e5don/iHPU6q7GCcnqoqtceQ/pJ8m66cvAnxwJlBFOTninhb2VjtvOfMQ07zPP+ZuYDPxvX5v3nd6yDa98yW4dZPuiGO2s6zJAfOPT2BrtyvLekItnSgAw3U5C0bOb+8XVKaDZQXbGEtOw6NZvD4L2yLd47nGkN2QXloiPLGyetrj3Z2pZYcrZBo8hAgMBAAGjaTBnMGUGA1UdAQReMFyAEOncRAPNcvJDoe4WP/gH2U+hNjA0MRIwEAYDVQQKEwlNaWNyb3NvZnQxHjAcBgNVBAMTFUJyayBMaXRlIFRlc3QgUm9vdCBDQYIQRggGmrpGj4pCblTanQRNUjAJBgUrDgMCHQUAA4IBAQCGyHhMdygS0g2tEUtRT4KFM+qqUY5HBpbIXNAav1a1dmXpHQCziuuxxzu3iq4XwnWUF1OabdDE2cpxNDOWxSsIxfEBf9ifaoz/O1ToJ0K757q2Rm2NWqQ7bNN8ArhvkNWa95S9gk9ZHZLUcjqanf0F8taJCYgzcbUSp+VBe9DcN89sJpYvfiBiAsMVqGPc/fHJgTScK+8QYrTRMubtFmXHbzBSO/KTAP5rBTxse88EGjK5F8wcedvge2Ksk6XjL3sZ19+Oj8KTQ72wihN900p1WQldHrrnbixSpmHBXbHr9U0NQigrJp5NphfuU5j81C8ixvfUdwyLmTv7rNA7GTAD";
579+
$rootCert = New-AzureRmVpnClientRootCertificate -Name $clientRootCertName -PublicCertData $samplePublicCertData
580+
581+
# Create the Virtual Network
582+
$subnet = New-AzureRmVirtualNetworkSubnetConfig -Name "GatewaySubnet" -AddressPrefix 10.0.0.0/24
583+
$vnet = New-AzureRmvirtualNetwork -Name $vnetName -ResourceGroupName $rgname -Location $location -AddressPrefix 10.0.0.0/16 -Subnet $subnet
584+
$vnet = Get-AzureRmvirtualNetwork -Name $vnetName -ResourceGroupName $rgname
585+
$subnet = Get-AzureRmVirtualNetworkSubnetConfig -Name "GatewaySubnet" -VirtualNetwork $vnet
586+
587+
# Create the IP config
588+
$publicip = New-AzureRmPublicIpAddress -ResourceGroupName $rgname -name $publicIpName -location $location -AllocationMethod Dynamic -DomainNameLabel $domainNameLabel
589+
$vnetIpConfig = New-AzureRmVirtualNetworkGatewayIpConfig -Name $vnetGatewayConfigName -PublicIpAddress $publicip -Subnet $subnet
590+
591+
# Create & Get IkeV2 + SSTP virtualnetworkgateway
592+
New-AzureRmVirtualNetworkGateway -ResourceGroupName $rgname -name $rname -location $location -IpConfigurations $vnetIpConfig -GatewayType Vpn -VpnType RouteBased -EnableBgp $false -GatewaySku VpnGw1 -VpnClientProtocol @( "IkeV2", "SSTP" ) -VpnClientAddressPool 201.169.0.0/16 -VpnClientRootCertificates $rootCert
593+
$actual = Get-AzureRmVirtualNetworkGateway -ResourceGroupName $rgname -name $rname
594+
Assert-AreEqual "VpnGw1" $actual.Sku.Tier
595+
$protocols = $actual.VpnClientConfiguration.VpnClientProtocols
596+
Assert-AreEqual 2 @($protocols).Count
597+
Assert-AreEqual "IkeV2" $protocols[0]
598+
Assert-AreEqual "SSTP" $protocols[1]
599+
Assert-AreEqual "201.169.0.0/16" $actual.VpnClientConfiguration.VpnClientAddressPool.AddressPrefixes
600+
601+
# Update gateway to IkeV2 only
602+
Set-AzureRmVirtualNetworkGateway -VirtualNetworkGateway $actual -VpnClientProtocol IkeV2
603+
$actual = Get-AzureRmVirtualNetworkGateway -ResourceGroupName $rgname -name $rname
604+
$protocols = $actual.VpnClientConfiguration.VpnClientProtocols
605+
Assert-AreEqual 1 @($protocols).Count
606+
Assert-AreEqual "IkeV2" $protocols[0]
607+
}
608+
finally
609+
{
610+
# Cleanup
611+
Clean-ResourceGroup $rgname
612+
}
613+
}

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

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

src/ResourceManager/Network/Commands.Network/Models/PSVpnClientConfiguration.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ public class PSVpnClientConfiguration
2828

2929
public string RadiusServerSecret;
3030

31+
public List<string> VpnClientProtocols { get; set; }
32+
3133
[JsonIgnore]
3234
public string VpnClientAddressPoolText
3335
{

src/ResourceManager/Network/Commands.Network/VirtualNetworkGateway/NewAzureVirtualNetworkGatewayCommand.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,16 @@ public class NewAzureVirtualNetworkGatewayCommand : VirtualNetworkGatewayBaseCmd
123123
[ValidateNotNullOrEmpty]
124124
public List<string> VpnClientAddressPool { get; set; }
125125

126+
[Parameter(
127+
Mandatory = false,
128+
ValueFromPipelineByPropertyName = true,
129+
HelpMessage = "The list of P2S VPN client tunneling protocols")]
130+
[ValidateSet(
131+
MNM.VpnClientProtocol.SSTP,
132+
MNM.VpnClientProtocol.IkeV2)]
133+
[ValidateNotNullOrEmpty]
134+
public List<string> VpnClientProtocol { get; set; }
135+
126136
[Parameter(
127137
Mandatory = false,
128138
ValueFromPipelineByPropertyName = true,
@@ -311,6 +321,16 @@ private PSVirtualNetworkGateway CreateVirtualNetworkGateway()
311321
vnetGateway.VpnClientConfiguration.VpnClientAddressPool.AddressPrefixes = this.VpnClientAddressPool;
312322
}
313323

324+
if (this.VpnClientProtocol != null)
325+
{
326+
vnetGateway.VpnClientConfiguration.VpnClientProtocols = this.VpnClientProtocol;
327+
}
328+
else
329+
{
330+
// set default
331+
vnetGateway.VpnClientConfiguration.VpnClientProtocols = new List<string> { MNM.VpnClientProtocol.SSTP, MNM.VpnClientProtocol.IkeV2 };
332+
}
333+
314334
if (this.VpnClientRootCertificates != null)
315335
{
316336
vnetGateway.VpnClientConfiguration.VpnClientRootCertificates = this.VpnClientRootCertificates;

src/ResourceManager/Network/Commands.Network/VirtualNetworkGateway/UpdateAzureVirtualNetworkGatewayCommand.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,16 @@ public class SetAzureVirtualNetworkGatewayCommand : VirtualNetworkGatewayBaseCmd
6666
[ValidateNotNullOrEmpty]
6767
public List<string> VpnClientAddressPool { get; set; }
6868

69+
[Parameter(
70+
Mandatory = false,
71+
ValueFromPipelineByPropertyName = true,
72+
HelpMessage = "A list of P2S VPN client tunneling protocols")]
73+
[ValidateSet(
74+
MNM.VpnClientProtocol.SSTP,
75+
MNM.VpnClientProtocol.IkeV2)]
76+
[ValidateNotNullOrEmpty]
77+
public List<string> VpnClientProtocol { get; set; }
78+
6979
[Parameter(
7080
Mandatory = false,
7181
ValueFromPipelineByPropertyName = true,
@@ -190,6 +200,11 @@ public override void Execute()
190200
this.VirtualNetworkGateway.VpnClientConfiguration.VpnClientAddressPool.AddressPrefixes = this.VpnClientAddressPool;
191201
}
192202

203+
if (this.VpnClientProtocol != null)
204+
{
205+
this.VirtualNetworkGateway.VpnClientConfiguration.VpnClientProtocols = this.VpnClientProtocol;
206+
}
207+
193208
if (this.VpnClientRootCertificates != null)
194209
{
195210
this.VirtualNetworkGateway.VpnClientConfiguration.VpnClientRootCertificates = this.VpnClientRootCertificates;

0 commit comments

Comments
 (0)