Skip to content

Commit

Permalink
Add mapping rule on VirtualNetworkEncryption (#18731)
Browse files Browse the repository at this point in the history
* add map

* test json file

* changelog

Co-authored-by: Dan Tu <dantu@microsoft.com>
  • Loading branch information
dtuCloud and Dan Tu authored Jun 27, 2022
1 parent 119ecfc commit 76400a9
Show file tree
Hide file tree
Showing 5 changed files with 686 additions and 975 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public void TestVirtualNetworkEdgeZone()
}

[Fact]
[Trait(Category.AcceptanceType, Category.LiveOnly)]
[Trait(Category.AcceptanceType, Category.CheckIn)]
[Trait(Category.Owner, NrpTeamAlias.sdnnrp)]
public void TestVirtualNetworkEncryption()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1573,6 +1573,7 @@ function Test-VirtualNetworkEncryption
Assert-AreEqual "dropUnencrypted" $vnet2.Encryption.Enforcement

# Update the encryption policies on both virtual networks
$vnet1.Encryption.Enabled = "false"
$vnet1.Encryption.Enforcement = "allowUnencrypted"
$vnet2.Encryption.Enforcement = "allowUnencrypted"
$updateVnet1Job = $vnet1 | Set-AzVirtualNetwork -AsJob
Expand All @@ -1585,7 +1586,7 @@ function Test-VirtualNetworkEncryption
# Perform GET operations to retrieve both virtual networks and verify that the encryption property is set to the expected value
$vnet1 = Get-AzVirtualNetwork -Name $vnet1Name -ResourceGroupName $rgname
$vnet2 = Get-AzVirtualNetwork -Name $vnet2Name -ResourceGroupName $rgname
Assert-AreEqual "true" $vnet1.Encryption.Enabled
Assert-AreEqual "false" $vnet1.Encryption.Enabled
Assert-AreEqual "true" $vnet2.Encryption.Enabled
Assert-AreEqual "allowUnencrypted" $vnet1.Encryption.Enforcement
Assert-AreEqual "allowUnencrypted" $vnet2.Encryption.Enforcement
Expand Down Expand Up @@ -1615,15 +1616,15 @@ function Test-VirtualNetworkEncryption
$vnet1 = Get-AzVirtualNetwork -Name $vnet1Name -ResourceGroupName $rgname
$vnet2 = Get-AzVirtualNetwork -Name $vnet2Name -ResourceGroupName $rgname
Assert-AreEqual "true" $vnet1.VirtualNetworkPeerings[0].RemoteVirtualNetworkEncryption.Enabled
Assert-AreEqual "true" $vnet2.VirtualNetworkPeerings[0].RemoteVirtualNetworkEncryption.Enabled
Assert-AreEqual "false" $vnet2.VirtualNetworkPeerings[0].RemoteVirtualNetworkEncryption.Enabled
Assert-AreEqual "allowUnencrypted" $vnet2.VirtualNetworkPeerings[0].RemoteVirtualNetworkEncryption.Enforcement
Assert-AreEqual "allowUnencrypted" $vnet1.VirtualNetworkPeerings[0].RemoteVirtualNetworkEncryption.Enforcement

# Get Peering to confirm the RemoteVirtualNetworkEncryption property
$peering1 = Get-AzVirtualNetworkPeering -Name $peering1Name -VirtualNetwork $vnet1Name -ResourceGroupName $rgname
$peering2 = Get-AzVirtualNetworkPeering -Name $peering2Name -VirtualNetwork $vnet2Name -ResourceGroupName $rgname
Assert-AreEqual "true" $peering1.RemoteVirtualNetworkEncryption.Enabled
Assert-AreEqual "true" $peering2.RemoteVirtualNetworkEncryption.Enabled
Assert-AreEqual "false" $peering2.RemoteVirtualNetworkEncryption.Enabled
Assert-AreEqual "allowUnencrypted" $peering1.RemoteVirtualNetworkEncryption.Enforcement
Assert-AreEqual "allowUnencrypted" $peering2.RemoteVirtualNetworkEncryption.Enforcement
}
Expand Down

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/Network/Network/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
- `Update-AzRouteServer`
* Fixed bug that can't parse CustomIpPrefixParent parameter from swagger to powershell.
* Added "Any" operator in New-AzApplicationGatewayFirewallCondition
* Fixed bugs that cannot parse virtual network encryption paramemters when updating exsiting vnet.

## Version 4.16.1
* Fixed `ArgumentNullException` in `Add-AzureRmRouteConfig` when `RouteTable.Routes` is null.
Expand Down
4 changes: 4 additions & 0 deletions src/Network/Network/Common/NetworkResourceManagerProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,10 @@ private static void Initialize()
cfg.CreateMap<MNM.BgpServiceCommunity, CNM.PSBgpServiceCommunity>();
cfg.CreateMap<MNM.BGPCommunity, CNM.PSBgpCommunity>();
// Virtual Network Encryption
cfg.CreateMap<CNM.PSVirtualNetworkEncryption, MNM.VirtualNetworkEncryption>();
cfg.CreateMap<MNM.VirtualNetworkEncryption, CNM.PSVirtualNetworkEncryption>();
// Subnet
// CNM to MNM
cfg.CreateMap<CNM.PSDhcpOptions, MNM.DhcpOptions>();
Expand Down

0 comments on commit 76400a9

Please sign in to comment.