diff --git a/src/Network/Network.Test/ScenarioTests/VirtualNetworkTests.cs b/src/Network/Network.Test/ScenarioTests/VirtualNetworkTests.cs
index 210ca8afa7e5..9dc4cf89b77e 100644
--- a/src/Network/Network.Test/ScenarioTests/VirtualNetworkTests.cs
+++ b/src/Network/Network.Test/ScenarioTests/VirtualNetworkTests.cs
@@ -50,8 +50,8 @@ public void TestVirtualNetworkSubnetCRUD()
TestRunner.RunTestScript("Test-subnetCRUD");
}
- [Fact]
- [Trait(Category.AcceptanceType, Category.CheckIn)]
+ [Fact(Skip = "Authentication failed for auxiliary token: The '1' auxiliary tokens contains duplicates which are from the same tenant.")]
+ [Trait(Category.AcceptanceType, Category.LiveOnly)]
[Trait(Category.Owner, NrpTeamAlias.sdnnrp)]
public void TestVirtualNetworkBgpCommunitiesCRUD()
{
diff --git a/src/Network/Network.Test/ScenarioTests/VirtualNetworkTests.ps1 b/src/Network/Network.Test/ScenarioTests/VirtualNetworkTests.ps1
index 34aebb124658..493b4b83fb5e 100644
--- a/src/Network/Network.Test/ScenarioTests/VirtualNetworkTests.ps1
+++ b/src/Network/Network.Test/ScenarioTests/VirtualNetworkTests.ps1
@@ -211,7 +211,10 @@ function Test-bgpCommunitiesCRUD
{
# Setup
$rgname = Get-ResourceGroupName
- $vnetName = Get-ResourceName
+ $vnet1Name = Get-ResourceName
+ $vnet2Name = Get-ResourceName
+ $peering1Name = Get-ResourceName
+ $peering2Name = Get-ResourceName
$rglocation = Get-ProviderLocation ResourceManagement
$resourceTypeParent = "Microsoft.Network/virtualNetworks"
$location = Get-ProviderLocation $resourceTypeParent "eastus2euap"
@@ -221,20 +224,37 @@ function Test-bgpCommunitiesCRUD
# Create the resource group
$resourceGroup = New-AzResourceGroup -Name $rgname -Location $rglocation -Tags @{ testtag = "testval" }
- # Create q virtual network with a BGP community
- New-AzVirtualNetwork -Name $vnetName -ResourceGroupName $rgname -Location $location -AddressPrefix 10.0.0.0/16 -BgpCommunity 12076:30000
-
- # Get the virtual network and verify that the community is set to the expected value
- $vnet = Get-AzVirtualNetwork -Name $vnetName -ResourceGroupName $rgname
- Assert-AreEqual "12076:30000" $vnet.BgpCommunities.VirtualNetworkCommunity
-
- # Update the virtual network with a different BGP community
- $vnet.BgpCommunities.VirtualNetworkCommunity = "12076:30001"
- $vnet | Set-AzVirtualNetwork
-
- # Get the virtual network and verify that the community is set to the new value
- $vnet = Get-AzVirtualNetwork -Name $vnetName -ResourceGroupName $rgname
- Assert-AreEqual "12076:30001" $vnet.BgpCommunities.VirtualNetworkCommunity
+ # Create two virtual networks with BGP communities
+ New-AzVirtualNetwork -Name $vnet1Name -ResourceGroupName $rgname -Location $location -AddressPrefix 10.1.0.0/16 -BgpCommunity 12076:20001
+ New-AzVirtualNetwork -Name $vnet2Name -ResourceGroupName $rgname -Location $location -AddressPrefix 10.2.0.0/16 -BgpCommunity 12076:20002
+
+ # Perform GET operations to retrieve both virtual networks and verify that the VirtualNetworkCommunity is set to the expected value
+ $vnet1 = Get-AzVirtualNetwork -Name $vnet1Name -ResourceGroupName $rgname
+ $vnet2 = Get-AzVirtualNetwork -Name $vnet2Name -ResourceGroupName $rgname
+ Assert-AreEqual "12076:20001" $vnet1.BgpCommunities.VirtualNetworkCommunity
+ Assert-AreEqual "12076:20002" $vnet2.BgpCommunities.VirtualNetworkCommunity
+
+ # Update the VirtualNetworkCommunity on both virtual networks
+ $vnet1.BgpCommunities.VirtualNetworkCommunity = "12076:20111"
+ $vnet2.BgpCommunities.VirtualNetworkCommunity = "12076:20222"
+ $vnet1 | Set-AzVirtualNetwork
+ $vnet2 | Set-AzVirtualNetwork
+
+ # Perform GET operations to retrieve both virtual networks and verify that the VirtualNetworkCommunity is set to the expected value
+ $vnet1 = Get-AzVirtualNetwork -Name $vnet1Name -ResourceGroupName $rgname
+ $vnet2 = Get-AzVirtualNetwork -Name $vnet2Name -ResourceGroupName $rgname
+ Assert-AreEqual "12076:20111" $vnet1.BgpCommunities.VirtualNetworkCommunity
+ Assert-AreEqual "12076:20222" $vnet2.BgpCommunities.VirtualNetworkCommunity
+
+ # Peer both virtual networks
+ Add-AzVirtualNetworkPeering -Name $peering1Name -VirtualNetwork $vnet1 -RemoteVirtualNetworkId $vnet2.Id
+ Add-AzVirtualNetworkPeering -Name $peering2Name -VirtualNetwork $vnet2 -RemoteVirtualNetworkId $vnet1.Id
+
+ # Perform GET operations to retrieve both virtual networks and validate the RemoteBgpCommunity property on the child peering resource
+ $vnet1 = Get-AzVirtualNetwork -Name $vnet1Name -ResourceGroupName $rgname
+ $vnet2 = Get-AzVirtualNetwork -Name $vnet2Name -ResourceGroupName $rgname
+ Assert-AreEqual "12076:20222" $vnet1.VirtualNetworkPeerings[0].RemoteBgpCommunities.VirtualNetworkCommunity
+ Assert-AreEqual "12076:20111" $vnet2.VirtualNetworkPeerings[0].RemoteBgpCommunities.VirtualNetworkCommunity
}
finally
{
diff --git a/src/Network/Network/ChangeLog.md b/src/Network/Network/ChangeLog.md
index 17d55e74f74d..1a74f48fbc12 100644
--- a/src/Network/Network/ChangeLog.md
+++ b/src/Network/Network/ChangeLog.md
@@ -19,6 +19,7 @@
--->
## Upcoming Release
+* Added RemoteBgpCommunities property to the VirtualNetwork Peering Resource
* Fixed parameters swap in VWan HubVnet connection
* Added new cmdlets for Azure Network Virtual Appliance Sites
- `Get-AzVirtualApplianceSite`
diff --git a/src/Network/Network/Models/PSVirtualNetworkPeering.cs b/src/Network/Network/Models/PSVirtualNetworkPeering.cs
index 337ccef1277b..0be040f2db9b 100644
--- a/src/Network/Network/Models/PSVirtualNetworkPeering.cs
+++ b/src/Network/Network/Models/PSVirtualNetworkPeering.cs
@@ -56,6 +56,9 @@ public class PSVirtualNetworkPeering : PSChildResource
[JsonProperty(Order = 1)]
public PSAddressSpace RemoteVirtualNetworkAddressSpace { get; set; }
+ [JsonProperty(Order = 1)]
+ public PSVirtualNetworkBgpCommunities RemoteBgpCommunities { get; set; }
+
[JsonProperty(Order = 1)]
[Ps1Xml(Target = ViewControl.Table)]
public string ProvisioningState { get; set; }
@@ -76,6 +79,12 @@ public string RemoteGatewaysText
public string RemoteVirtualNetworkAddressSpaceText
{
get { return JsonConvert.SerializeObject(RemoteVirtualNetworkAddressSpace, Formatting.Indented, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore }); }
- }
+ }
+
+ [JsonIgnore]
+ public string RemoteBgpCommunitiesText
+ {
+ get { return JsonConvert.SerializeObject(RemoteBgpCommunities, Formatting.Indented, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore }); }
+ }
}
}
diff --git a/src/Network/Network/Network.format.ps1xml b/src/Network/Network/Network.format.ps1xml
index f18efb388906..0d2b1f189e23 100644
--- a/src/Network/Network/Network.format.ps1xml
+++ b/src/Network/Network/Network.format.ps1xml
@@ -1375,6 +1375,15 @@
RemoteVirtualNetworkAddressSpaceText
+
+
+ RemoteBgpCommunitiesText
+
+
+ !($_.RemoteBgpCommunities -eq $null)
+
+
+