Skip to content

Commit 50aaa7a

Browse files
Khushboo-Bahetidingmeng-xuewyunchi-msxaliciayangbowen0106
authored
Virtual Network Gateway Commandlets Update for BgpSettings (Azure#11424)
* Update ChangeLog.md * Correct version for changelog.md * Polish content for changelog.md * Add network release * For RC2 build * ps-vsprompt * removed ps-vsprompt from PR * add comma * change dogfood endpoint in session records * add servers back into vulnerability * BugFix for PrivateLinkServiceConnectionState * Added three required assemblies for the AzAttestation PowerShell cmdlets. (Microsoft.IdentityModel.*) * ltr policy record * Updated ChangeLog.md * re-recorded backup tests * update virtualhub cmdlets also * add resource types * comment edits * Get-AzGalleryImageVersion fix example args Update samples to use proper argument -GalleryImageDefinitionName not -ImageDefinitionName * for RC2 release * update changelog * updated changelog * updated changelog for upcoming release * Fix typo infomation→information * PR comments has been resolved * Updated help content * Display ResourceManager correlationIds in error output * close ticket function. * For final RC * For final RC * Adding SensitivityRank parameter to DataClassification Set Cmdlets * typo, unused imports. - enable severity, status tests. update properties count( since prod outage was removed). add tests for ticket status. * properties count to 5 * count for prob class to 5 * fix get-azresource -ResourceGroupName -Name -ResourceType to use correct ApiVersion * Complete cmdlet implementations * fix get-azresource -ResourceGroupName -Name -ExpandProperties -ResourceType to use correct ApiVersion * Fix Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.dll.json Azure#10826 * Fix changelog merge issue * remove override DefaultContext * Restore-AzSqlInstanceDatabase - fix "an" -> "a" Examples: fix "an deleted instance" to "a deleted instance" * Add changelog entry * chore) update privacy notice text * Update changelog.md per contributing.md * chore) minor text correction * Improve PolicyInsights error messages * Address reviwer comments * Add note about the version of PowerShell * fix changelog merge error * Minor helper file fix * update macos to 10.14 * Add DisableAzureSqlServerActiveDirectoryOnlyAuthentication.cs file itself. * Add DisableAzureSqlServerActiveDirectoryOnlyAuthentication.cs file itself. * disable one test case that is unstable on linux * remove file * add DisableAzureSqlServerActiveDirectoryOnlyAuthentication.cs * Create DisableAzureSqlServerActiveDirectoryOnlyAuthentication.cs * Update ChangeLog.md add cmdlet Disable-AzSqlServerActiveDirectoryOnlyAuthentication * Update ChangeLog.md * SAP AEM: add support for the new VM Extension for SAP * Update ChangeLog.md remove edit to this file * Update ChangeLog.md * Add cmdlet Disable-AzSqlServerActiveDirectoryOnlyAuthentication to upcoming section. * Fixing the parameter name IsAzureADOnlyAuthentication and documentation * reprotect and Update bug fixes * add an alias to avoid breaking change * Update the azure powershell developer guide with autorest powershell generator related materials * Update the category. * change log * Update syntax in help files. * Update C# SDK to throw Cloud Exception, Update default SKU to be ST2 * Escape single quote * add TestGetResourceByNameAndType test for apiversion check * updating tests and adding completer * fix changelog merge error * updating help files and tests * add breaking changes * Update files * Update encoding to UTF8 * Add breaking changes (Azure#11329) * add breaking changes * Change useragent to align to Az3.0 modules * Update Get-AzResourceLock.md Added an example that uses the -AtScope parameter. * Update ChangeLog.md * Consume modified SDK clients. * Remove unnecessary changes. * Fix doc Microsot→Microsoft add dot * Add a test case for Save-AzDeploymentScript cmdlet; update test recordings; update help messages; address reviewer comments * Remove duplicate cmdlet names in Az.Resources.psd1 * Add change log comment * Update Network SDK & test recordings * add license header to ArrayExtension.cs * Updated error messages and help files. - Share service provided details for 4xx HTTP status codes - Updated help file examples to be accurate and consistent * Update tests, tests records and help files. * Update New-AzVmss for AutomaticRepairsPolicy issue. * Update Compute SDK version to 33.0.0 * Updated CosmosDB Management version * Updated TEE type name VSMEnclave to VBSEnclave * Updated ChangeLog * Removed the new version header from ChangeLog * Added option of Byte encoding for New-AzDataLakeStoreItem, Add-AzDAtaLakeStoreItemContent, Get-AzDAtaLakeStoreItemContent * Update URLs in help files * AppGw recordings * Updated CosmosDB Management SDK version (Azure#11351) * Updated CosmosDB Management version * Updated ChangeLog * Removed the new version header from ChangeLog Co-authored-by: Meha Kaushik <[email protected]> * [ASR] [V2A] Adding properties for VMware DR monitoring * Update * bump up version * Fix the bug that RunVerioncontroller.ps1 act different under different directory. * CredSan suppression * Update tests file. * Adding SensitivityRank parameter to DataClassification Set Cmdlets * Update syntax in help files. * Consume modified SDK clients. * Remove unnecessary changes. * Update tests, tests records and help files. * Update tests file. * Update ChangeLog.md * Update Management.Sql package version * Add rerun support to create pipeline run cmdlet * Update changeLog * Fix * addressing review comments * ChangeLog update * add comment, add byte encoding for auto completion * 1.Support customers specify min TLS version when creating cluster 2. Update New-AzHDInsightConfig.md * Added retrying policy update * updated paramsets and added help file * Fix after merge * Update README.md * Fixing bugs and Allowing Gremlin, Cassandra, Table api account creation * Allow Encryption property to Target parameter of New-AzGalleryImageVersion cmdlet Add the following parameters to New-AzDiskConfig: DiskIOPSReadOnly, DiskMBpsReadOnly, MaxSharesCount, GalleryImageReference Fix tempDisk issue * suppress breaking change issue from int to long * Replace Sql client using generic rest client * Update change log * Fixing Cassandra schema and Mongo shard key null values * Adding in ChangeLog * Updated Help * Revise according to review * Adding chnage1 * Commit1 * adding command * fix * Final Commit * Adding Test Scenarios * Updating changelog * updating changelog1 * FixingNewGatewayCmd * Adding Tests for NewGateway * Fixing helpmd * Adding helpfile * fixing md file * Fixing helpmd * Adding chnage1 * Commit1 * adding command * fix * Final Commit * Adding Test Scenarios * Updating changelog * updating changelog1 * FixingNewGatewayCmd * Adding Tests for NewGateway * Fixing helpmd * Adding helpfile * Fixing helpmd Co-authored-by: Dingmeng Xue <[email protected]> Co-authored-by: [email protected] <[email protected]> Co-authored-by: Yunchi Wang <[email protected]> Co-authored-by: xaliciayang <[email protected]> Co-authored-by: xaliciayang <[email protected]> Co-authored-by: Bo Wen <[email protected]> Co-authored-by: gkostal <[email protected]> Co-authored-by: Ritvika Nagula <[email protected]> Co-authored-by: Yabo Hu <[email protected]> Co-authored-by: aygoya <[email protected]> Co-authored-by: Bill Sproule <[email protected]> Co-authored-by: bashahee <[email protected]> Co-authored-by: Yeming Liu <[email protected]> Co-authored-by: Yeming Liu <[email protected]> Co-authored-by: Ikko Ashimine <[email protected]> Co-authored-by: Sapan Saxena <[email protected]> Co-authored-by: Anthony Martin <[email protected]> Co-authored-by: bashahee <[email protected]> Co-authored-by: Jason Gilbertson <[email protected]> Co-authored-by: Filiz Topatan <[email protected]> Co-authored-by: msJinLei <[email protected]> Co-authored-by: Hans De Mulder <[email protected]> Co-authored-by: Sudhindra Kovalam <[email protected]> Co-authored-by: Chris Eggert <[email protected]> Co-authored-by: Damien Caro <[email protected]> Co-authored-by: Nilambari <[email protected]> Co-authored-by: Nilambari <[email protected]> Co-authored-by: Amol Agarwal <[email protected]> Co-authored-by: Amol Agarwal <[email protected]> Co-authored-by: MSSedusch <[email protected]> Co-authored-by: ayfathim <[email protected]> Co-authored-by: Xiaogang Ding <[email protected]> Co-authored-by: Teng Lu <[email protected]> Co-authored-by: shahbj79 <[email protected]> Co-authored-by: Bhavin Shah <[email protected]> Co-authored-by: Peter Lorenzen <[email protected]> Co-authored-by: erich-wang <[email protected]> Co-authored-by: Anton Evseev <[email protected]> Co-authored-by: Hyonho Lee <[email protected]> Co-authored-by: Meha Kaushik <[email protected]> Co-authored-by: Rahul Dutta <[email protected]> Co-authored-by: Meha Kaushik <[email protected]> Co-authored-by: Vidyadhari Jami <[email protected]> Co-authored-by: wyunchi-ms <[email protected]> Co-authored-by: lijzha <[email protected]> Co-authored-by: Jin Lei <[email protected]> Co-authored-by: Zhenyu Zhou <[email protected]> Co-authored-by: sambitratha <[email protected]> Co-authored-by: Sambit Rath <[email protected]> Co-authored-by: Khushboo Baheti <[email protected]>
1 parent d5299d0 commit 50aaa7a

16 files changed

+9773
-9605
lines changed

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,18 @@ function Test-VirtualNetworkGatewayCRUD
112112

113113
# Create & Get virtualnetworkgateway
114114
$vnetIpConfig = New-AzVirtualNetworkGatewayIpConfig -Name $vnetGatewayConfigName -PublicIpAddress $publicip -Subnet $subnet
115-
$job = New-AzVirtualNetworkGateway -ResourceGroupName $rgname -name $rname -location $location -IpConfigurations $vnetIpConfig -GatewayType Vpn -VpnType RouteBased -EnableBgp $false -AsJob
115+
$ipconfigurationId = $vnetIpConfig.id
116+
$addresslist = @('169.254.21.25')
117+
$gw1ipconfBgp = New-AzIpConfigurationBgpPeeringAddressObject -IpConfigurationId $ipconfigurationId -CustomAddress $addresslist
118+
$job = New-AzVirtualNetworkGateway -ResourceGroupName $rgname -name $rname -location $location -IpConfigurations $vnetIpConfig -IpConfigurationBgpPeeringAddresses $gw1ipconfBgp -GatewayType Vpn -VpnType RouteBased -EnableBgp $false -AsJob
116119
$job | Wait-Job
117120
$actual = $job | Receive-Job
118121
$expected = Get-AzVirtualNetworkGateway -ResourceGroupName $rgname -name $rname
119122
Assert-AreEqual $expected.ResourceGroupName $actual.ResourceGroupName
120123
Assert-AreEqual $expected.Name $actual.Name
121124
Assert-AreEqual "Vpn" $expected.GatewayType
122125
Assert-AreEqual "RouteBased" $expected.VpnType
126+
Assert-AreEqual 1 @($expected.BgpSettings.BGPPeeringAddresses).Count
123127

124128
# List virtualNetworkGateways
125129
$list = Get-AzVirtualNetworkGateway -ResourceGroupName $rgname
@@ -281,6 +285,13 @@ function Test-SetVirtualNetworkGatewayCRUD
281285
Assert-AreEqual $asn $gateway.BgpSettings.Asn
282286
Assert-AreEqual $peerWeight $gateway.BgpSettings.PeerWeight
283287

288+
# BGPPeeringAddresses
289+
$ipconfigurationId1 = $gateway.ipconfigurations[0].id
290+
$addresslist1 = @('169.254.21.10')
291+
$gw1ipconfBgp1 = New-AzIpConfigurationBgpPeeringAddressObject -IpConfigurationId $ipconfigurationId1 -CustomAddress $addresslist1
292+
$gateway = Set-AzVirtualNetworkGateway -VirtualNetworkGateway $gateway -IpConfigurationBgpPeeringAddresses $gw1ipconfBgp1
293+
Assert-AreEqual $ipconfigurationId1 $gateway.BgpSettings.BGPPeeringAddresses[0].IpConfigurationId
294+
284295
# Tags
285296
$gateway = Set-AzVirtualNetworkGateway -VirtualNetworkGateway $gateway -Tag @{ testtagKey="SomeTagKey"; testtagValue="SomeKeyValue" }
286297
Assert-AreEqual 2 $gateway.Tag.Count

src/Network/Network.Test/SessionRecords/Commands.Network.Test.ScenarioTests.VirtualNetworkGatewayTests/TestSetVirtualNetworkGatewayCRUD.json

Lines changed: 4721 additions & 5040 deletions
Large diffs are not rendered by default.

src/Network/Network.Test/SessionRecords/Commands.Network.Test.ScenarioTests.VirtualNetworkGatewayTests/TestVirtualNetworkGatewayCRUD.json

Lines changed: 4464 additions & 4393 deletions
Large diffs are not rendered by default.

src/Network/Network/Az.Network.psd1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,8 @@ CmdletsToExport = 'Add-AzApplicationGatewayAuthenticationCertificate',
464464
'Get-AzVirtualRouter', 'Add-AzVirtualRouterPeer',
465465
'Update-AzVirtualRouterPeer', 'Remove-AzVirtualRouterPeer',
466466
'Get-AzVirtualRouterPeer', 'New-AzIpGroup', 'Remove-AzIpGroup',
467-
'Get-AzIpGroup', 'Set-AzIpGroup'
467+
'Get-AzIpGroup', 'Set-AzIpGroup',
468+
'New-AzIpConfigurationBgpPeeringAddressObject'
468469

469470
# Variables to export from this module
470471
# VariablesToExport = @()

src/Network/Network/ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
- `New-AzVirtualHub`
2828
- `Update-AzVirtualHub`
2929
* Removed Sql Management SDK dependency
30+
* Added 'New-AzIpConfigurationBgpPeeringAddressObject'
31+
* Updated 'Set-AzVirtualNetworkGateway' and 'New-AzVirtualNetworkGateway'
3032

3133
## Version 2.3.2
3234
* Updated Sql Management SDK.

src/Network/Network/Common/NetworkResourceManagerProfile.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -875,6 +875,7 @@ private static void Initialize()
875875
cfg.CreateMap<CNM.PSBGPPeerStatus, MNM.BgpPeerStatus>();
876876
cfg.CreateMap<CNM.PSGatewayRoute, MNM.GatewayRoute>();
877877
cfg.CreateMap<CNM.PSVpnClientConnectionHealthDetail, MNM.VpnClientConnectionHealthDetail>();
878+
cfg.CreateMap<CNM.PSIpConfigurationBgpPeeringAddress, MNM.IPConfigurationBgpPeeringAddress>();
878879

879880
// MNM to CNM
880881
cfg.CreateMap<MNM.VirtualNetworkGateway, CNM.PSVirtualNetworkGateway>();
@@ -895,6 +896,7 @@ private static void Initialize()
895896
cfg.CreateMap<MNM.BgpPeerStatus, CNM.PSBGPPeerStatus>();
896897
cfg.CreateMap<MNM.GatewayRoute, CNM.PSGatewayRoute>();
897898
cfg.CreateMap<MNM.VpnClientConnectionHealthDetail, CNM.PSVpnClientConnectionHealthDetail>();
899+
cfg.CreateMap<MNM.IPConfigurationBgpPeeringAddress, CNM.PSIpConfigurationBgpPeeringAddress>();
898900

899901
// Application Gateways
900902
// CNM to MNM

src/Network/Network/Generated/Models/PSBgpSettings.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
using Microsoft.Azure.Management.Network.Models;
2828
using Microsoft.WindowsAzure.Commands.Common.Attributes;
2929
using Newtonsoft.Json;
30+
using System.Collections.Generic;
3031

3132
namespace Microsoft.Azure.Commands.Network.Models
3233
{
@@ -38,5 +39,6 @@ public partial class PSBgpSettings
3839
public string BgpPeeringAddress { get; set; }
3940
[Ps1Xml(Target = ViewControl.Table)]
4041
public int? PeerWeight { get; set; }
42+
public List<PSIpConfigurationBgpPeeringAddress> BgpPeeringAddresses { get; set; }
4143
}
4244
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
16+
using System.Collections.Generic;
17+
18+
namespace Microsoft.Azure.Commands.Network.Models
19+
{
20+
public class PSIpConfigurationBgpPeeringAddress : PSChildResource
21+
{
22+
public string IpconfigurationId;
23+
24+
public List<string> DefaultBgpIpAddresses;
25+
26+
public List<string> CustomBgpIpAddresses;
27+
28+
public List<string> TunnelIpAddresses;
29+
}
30+
}

src/Network/Network/VirtualNetworkGateway/ChildResourceHelp.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public static string GetResourceNotSetId(string subscriptionId, string resource,
5252
resourceName);
5353
}
5454

55-
private static string NormalizeVirtualNetworkGatewayChildResourceIds(string id, string resourceGroupName, string VirtualNetworkGatewayName)
55+
public static string NormalizeVirtualNetworkGatewayChildResourceIds(string id, string resourceGroupName, string VirtualNetworkGatewayName)
5656
{
5757
id = NormalizeId(id, "resourceGroups", resourceGroupName);
5858
id = NormalizeId(id, "virtualNetworkGateways", VirtualNetworkGatewayName);
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// Licensed under the Apache License, Version 2.0 (the "License");
2+
// you may not use this file except in compliance with the License.
3+
// You may obtain a copy of the License at
4+
// http://www.apache.org/licenses/LICENSE-2.0
5+
// Unless required by applicable law or agreed to in writing, software
6+
// distributed under the License is distributed on an "AS IS" BASIS,
7+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8+
// See the License for the specific language governing permissions and
9+
// limitations under the License.
10+
// ----------------------------------------------------------------------------------
11+
12+
using Microsoft.Azure.Commands.Network.Models;
13+
using Microsoft.Azure.Management.Network.Models;
14+
using System;
15+
using System.Collections.Generic;
16+
using System.Management.Automation;
17+
18+
namespace Microsoft.Azure.Commands.Network.VirtualNetworkGateway
19+
{
20+
[Cmdlet("New", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "IpConfigurationBgpPeeringAddressObject",
21+
DefaultParameterSetName = "ByName", SupportsShouldProcess = true), OutputType(typeof(PSIpConfigurationBgpPeeringAddress))]
22+
23+
public class NewAzIpConfigurationBgpPeeringAddressObjectCommand : VirtualNetworkGatewayBaseCmdlet
24+
{
25+
[Parameter(
26+
ParameterSetName = "ByName",
27+
Mandatory = true,
28+
HelpMessage = "The virtual network gateway IpConfigurationId for BgpPeeringAddresses.")]
29+
[ValidateNotNullOrEmpty]
30+
public string IpConfigurationId { get; set; }
31+
32+
[Parameter(
33+
ParameterSetName = "ByName",
34+
Mandatory = true,
35+
HelpMessage = "The virtual network gateway CustomAddress List for BgpPeeringAddresses.")]
36+
[ValidateNotNullOrEmpty]
37+
public List<string> CustomAddress { get; set; }
38+
39+
public override void Execute()
40+
{
41+
base.Execute();
42+
var output = new PSIpConfigurationBgpPeeringAddress();
43+
output.IpconfigurationId = this.IpConfigurationId;
44+
output.CustomBgpIpAddresses = this.CustomAddress;
45+
WriteObject(output);
46+
}
47+
}
48+
}

src/Network/Network/VirtualNetworkGateway/NewAzureVirtualNetworkGatewayCommand.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,13 @@ public class NewAzureVirtualNetworkGatewayCommand : VirtualNetworkGatewayBaseCmd
206206
HelpMessage = "The weight added to routes learned over BGP from this virtual network gateway")]
207207
public int PeerWeight { get; set; }
208208

209+
[Parameter(
210+
Mandatory = false,
211+
ValueFromPipelineByPropertyName = true,
212+
HelpMessage = "The BgpPeeringAddresses for Virtual network gateway bgpsettings.")]
213+
[ValidateNotNullOrEmpty]
214+
public PSIpConfigurationBgpPeeringAddress[] IpConfigurationBgpPeeringAddresses { get; set; }
215+
209216
[Parameter(
210217
Mandatory = false,
211218
ValueFromPipelineByPropertyName = true,
@@ -465,6 +472,26 @@ private PSVirtualNetworkGateway CreateVirtualNetworkGateway()
465472
}
466473
}
467474

475+
if (this.IpConfigurationBgpPeeringAddresses != null)
476+
{
477+
if(vnetGateway.BgpSettings == null)
478+
{
479+
vnetGateway.BgpSettings = new PSBgpSettings();
480+
}
481+
482+
vnetGateway.BgpSettings.BgpPeeringAddresses = new List<PSIpConfigurationBgpPeeringAddress>();
483+
484+
foreach (var address in this.IpConfigurationBgpPeeringAddresses)
485+
{
486+
address.IpconfigurationId = FormatIdBgpPeeringAddresses(address.IpconfigurationId, this.ResourceGroupName, this.Name);
487+
vnetGateway.BgpSettings.BgpPeeringAddresses.Add(address);
488+
}
489+
}
490+
else if(vnetGateway.BgpSettings != null)
491+
{
492+
vnetGateway.BgpSettings.BgpPeeringAddresses = null;
493+
}
494+
468495
if (this.CustomRoute != null && this.CustomRoute.Any())
469496
{
470497
vnetGateway.CustomRoutes = new PSAddressSpace();

src/Network/Network/VirtualNetworkGateway/UpdateAzureVirtualNetworkGatewayCommand.cs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,13 @@ public class SetAzureVirtualNetworkGatewayCommand : VirtualNetworkGatewayBaseCmd
116116
HelpMessage = "The weight added to routes learned over BGP from this virtual network gateway")]
117117
public int PeerWeight { get; set; }
118118

119+
[Parameter(
120+
Mandatory = false,
121+
ValueFromPipelineByPropertyName = true,
122+
HelpMessage = "The BgpPeeringAddresses for Virtual network gateway bgpsettings.")]
123+
[ValidateNotNullOrEmpty]
124+
public PSIpConfigurationBgpPeeringAddress[] IpConfigurationBgpPeeringAddresses { get; set; }
125+
119126
[Parameter(
120127
Mandatory = false,
121128
HelpMessage = "Flag to enable Active Active feature on virtual network gateway")]
@@ -340,6 +347,44 @@ public override void Execute()
340347
throw new ArgumentException("PeerWeight must be a positive integer");
341348
}
342349

350+
if(this.IpConfigurationBgpPeeringAddresses != null)
351+
{
352+
if(this.VirtualNetworkGateway.BgpSettings == null)
353+
{
354+
this.VirtualNetworkGateway.BgpSettings = new PSBgpSettings();
355+
}
356+
357+
if (this.VirtualNetworkGateway.BgpSettings.BgpPeeringAddresses == null)
358+
{
359+
this.VirtualNetworkGateway.BgpSettings.BgpPeeringAddresses = new List<PSIpConfigurationBgpPeeringAddress>();
360+
361+
foreach (var address in this.IpConfigurationBgpPeeringAddresses)
362+
{
363+
this.VirtualNetworkGateway.BgpSettings.BgpPeeringAddresses.Add(address);
364+
}
365+
}
366+
else
367+
{
368+
foreach (var address in this.IpConfigurationBgpPeeringAddresses)
369+
{
370+
bool isGatewayIpConfigurationExists = this.VirtualNetworkGateway.BgpSettings.BgpPeeringAddresses.Any(
371+
ipconfaddress => ipconfaddress.IpconfigurationId.Equals(address.IpconfigurationId, StringComparison.OrdinalIgnoreCase));
372+
373+
if(isGatewayIpConfigurationExists)
374+
{
375+
var bgpPeeringPropertiesInRequest = this.VirtualNetworkGateway.BgpSettings.BgpPeeringAddresses.FirstOrDefault(
376+
x => x.IpconfigurationId.Equals(address.IpconfigurationId, StringComparison.OrdinalIgnoreCase));
377+
378+
bgpPeeringPropertiesInRequest.CustomBgpIpAddresses = address.CustomBgpIpAddresses;
379+
}
380+
else
381+
{
382+
this.VirtualNetworkGateway.BgpSettings.BgpPeeringAddresses.Add(address);
383+
}
384+
}
385+
}
386+
}
387+
343388
if (this.CustomRoute != null && this.CustomRoute.Any())
344389
{
345390
this.VirtualNetworkGateway.CustomRoutes = new PSAddressSpace();

src/Network/Network/VirtualNetworkGateway/VirtualNetworkGatewayBaseCmdlet.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,12 @@ public PSVpnClientIPsecParameters GetVpnClientIpsecParameters(string resourceGro
7777

7878
return psVpnClientIPsecParameters;
7979
}
80+
81+
public string FormatIdBgpPeeringAddresses(string id, string resourceGroupName, string resourceName)
82+
{
83+
string result = ChildResourceHelp.NormalizeVirtualNetworkGatewayChildResourceIds(id, resourceGroupName, resourceName);
84+
result = result.Replace("virtualNetworkGatewayIpConfiguration", "ipConfigurations");
85+
return result;
86+
}
8087
}
8188
}

0 commit comments

Comments
 (0)