diff --git a/src/Network/Network.Test/ScenarioTests/VirtualNetworkTests.cs b/src/Network/Network.Test/ScenarioTests/VirtualNetworkTests.cs index 98a30bead716..1f7a68c8d9a7 100644 --- a/src/Network/Network.Test/ScenarioTests/VirtualNetworkTests.cs +++ b/src/Network/Network.Test/ScenarioTests/VirtualNetworkTests.cs @@ -169,4 +169,4 @@ public void TestVirtualNetworkInEdgeZone() TestRunner.RunTestScript("Test-VirtualNetworkInEdgeZone"); } } -} +} \ No newline at end of file diff --git a/src/Network/Network.Test/ScenarioTests/VirtualNetworkTests.ps1 b/src/Network/Network.Test/ScenarioTests/VirtualNetworkTests.ps1 index 742a1d46314e..e755e055b945 100644 --- a/src/Network/Network.Test/ScenarioTests/VirtualNetworkTests.ps1 +++ b/src/Network/Network.Test/ScenarioTests/VirtualNetworkTests.ps1 @@ -1295,7 +1295,6 @@ function Test-VirtualNetworkSubnetServiceEndpointPolicies <# .SYNOPSIS -<<<<<<< HEAD Tests creating new virtual network with flow timeout. #> function Test-VirtualNetworkCRUD-FlowTimeout @@ -1474,11 +1473,11 @@ Tests whether virtual network put to an edge zone is successful. function Test-VirtualNetworkInEdgeZone { # Setup - $ResourceGroup = Get-ResourceGroupName; + $ResourceGroup = Get-ResourceGroupName; $LocationName = "westus"; $EdgeZone = "microsoftlosangeles1"; - $NetworkName = "MyNet"; + $NetworkName = "MyNet"; $SubnetName = "MySubnet"; $SubnetAddressPrefix = "10.0.0.0/24"; $VnetAddressPrefix = "10.0.0.0/16"; @@ -1487,11 +1486,11 @@ function Test-VirtualNetworkInEdgeZone # Create the resource group New-AzResourceGroup -Name $ResourceGroup -Location $LocationName -Force; - $SingleSubnet = New-AzVirtualNetworkSubnetConfig -Name $SubnetName -AddressPrefix $SubnetAddressPrefix; + $SingleSubnet = New-AzVirtualNetworkSubnetConfig -Name $SubnetName -AddressPrefix $SubnetAddressPrefix; New-AzVirtualNetwork -Name $NetworkName -ResourceGroupName $ResourceGroup -Location $LocationName -EdgeZone $EdgeZone -AddressPrefix $VnetAddressPrefix -Subnet $SingleSubnet; - $Vnet = Get-AzVirtualNetwork -Name $NetworkName -ResourceGroupName $ResourceGroup - Assert-AreEqual $Vnet.ExtendedLocation.Name $EdgeZone + $Vnet = Get-AzVirtualNetwork -Name $NetworkName -ResourceGroupName $ResourceGroup + Assert-AreEqual $Vnet.ExtendedLocation.Name $EdgeZone } finally { diff --git a/src/Network/Network/help/New-AzVirtualNetwork.md b/src/Network/Network/help/New-AzVirtualNetwork.md index 058319741d48..a92d67dd94d1 100644 --- a/src/Network/Network/help/New-AzVirtualNetwork.md +++ b/src/Network/Network/help/New-AzVirtualNetwork.md @@ -14,7 +14,7 @@ Creates a virtual network. ## SYNTAX ``` -New-AzVirtualNetwork -Name -ResourceGroupName -Location [-EdgeZone ] -AddressPrefix +New-AzVirtualNetwork -Name -ResourceGroupName -Location -AddressPrefix [-EdgeZone ] [-DnsServer ] [-FlowTimeout ] [-Subnet ] [-BgpCommunity ] [-Tag ] [-EnableDdosProtection] [-DdosProtectionPlanId ] [-IpAllocation ] [-Force] [-AsJob] [-DefaultProfile ] [-WhatIf] [-Confirm] [] diff --git a/src/Network/Network/help/Set-AzVirtualNetworkGateway.md b/src/Network/Network/help/Set-AzVirtualNetworkGateway.md index a75f5da8ab8a..2b11f3587466 100644 --- a/src/Network/Network/help/Set-AzVirtualNetworkGateway.md +++ b/src/Network/Network/help/Set-AzVirtualNetworkGateway.md @@ -360,25 +360,92 @@ The fifth command set this new created PSVirtualNetworkGatewayNatRule to NatRule ### Example 7: Delete multiple expired VpnClientRootCertificates of an existing virtual network gateway ``` -PS C:\>$Gateway=Get-Azvirtualnetworkgateway -ResourceGroupName "ResourceGroup001" -Name "Gateway001" - -PS C:\>$rootCerts=$Gateway.VpnClientConfiguration.VpnClientRootCertificates - -PS C:\>$rootCerts.Count -PS C:\>$rootCerts[0] -PS C:\>$rootCerts[1] -PS C:\>$rootCerts.Remove($rootCerts[1]) - -PS C:\>$Gateway1 = Set-AzVirtualNetworkGateway -VirtualNetworkGateway $Gateway -VpnClientRootCertificates $rootCerts +PS C:\>$Gateway = Get-AzVirtualNetworkGateway -ResourceGroupName "ResourceGroup001" -Name "Gateway001" +PS C:\>$vngNatRules = $Gateway.NatRules +PS C:\>$natRule = New-AzVirtualNetworkGatewayNatRule -Name "natRule1" -Type "Static" -Mode "IngressSnat" -InternalMapping @("25.0.0.0/16") -ExternalMapping @("30.0.0.0/16") +PS C:\>$vngNatRules.Add($natrule) +PS C:\>Set-AzVirtualNetworkGateway -VirtualNetworkGateway $Gateway -NatRule $vngNatRules.NatRules -BgpRouteTranslationForNat $true +Name : Gateway001 +ResourceGroupName : ResourceGroup001 +Location : westcentralus +Id : /subscriptions/59ac12a6-f2b7-46d4-af3d-98ba9d9dbd92/resourceGroups/ResourceGroup001/providers/Microsoft.Network/virtualNetworkGateways/Gateway001 +Etag : W/"a08f13d3-6106-44e0-9127-e35e6f9793d5" +ResourceGuid : 30993429-a1ed-42ca-9862-9156b013626e +ProvisioningState : Succeeded +Tags : +IpConfigurations : [ + { + "PrivateIpAllocationMethod": "Dynamic", + "Subnet": { + "Id": "/subscriptions/59ac12a6-f2b7-46d4-af3d-98ba9d9dbd92/resourceGroups/ResourceGroup001/providers/Microsoft.Network/virtualNetworks/newApipaNet/subnets/GatewaySubnet" + }, + "PublicIpAddress": { + "Id": "/subscriptions/59ac12a6-f2b7-46d4-af3d-98ba9d9dbd92/resourceGroups/ResourceGroup001/providers/Microsoft.Network/publicIPAddresses/newapipaip" + }, + "Name": "default", + "Etag": "W/\"a08f13d3-6106-44e0-9127-e35e6f9793d5\"", + "Id": "/subscriptions/59ac12a6-f2b7-46d4-af3d-98ba9d9dbd92/resourceGroups/ResourceGroup001/providers/Microsoft.Network/virtualNetworkGateways/Gateway001/ipConfigurations/default" + } + ] +GatewayType : Vpn +VpnType : RouteBased +EnableBgp : False +ActiveActive : False +GatewayDefaultSite : null +Sku : { + "Capacity": 2, + "Name": "VpnGw1", + "Tier": "VpnGw1" + } +VpnClientConfiguration : null +BgpSettings : { + "Asn": 65515, + "BgpPeeringAddress": "10.1.255.30", + "PeerWeight": 0, + "BgpPeeringAddresses": [ + { + "IpconfigurationId": "/subscriptions/59ac12a6-f2b7-46d4-af3d-98ba9d9dbd92/resourceGroups/ResourceGroup001/providers/Microsoft.Network/virtualNetworkGateways/Gateway001/ipConfigurations/default", + "DefaultBgpIpAddresses": [ + "10.1.255.30" + ], + "CustomBgpIpAddresses": [ + "169.254.21.55" + ], + "TunnelIpAddresses": [ + "13.78.146.151" + ] + } + ] + } +NatRules : [ + { + "VirtualNetworkGatewayNatRulePropertiesType": "Static", + "Mode": "IngressSnat", + "InternalMappings": [ + { + "AddressSpace": "25.0.0.0/16" + } + ], + "ExternalMappings": [ + { + "AddressSpace": "30.0.0.0/16" + } + ], + "ProvisioningState": "Succeeded", + "Name": "natRule1", + "Etag": "W/\"5150d788-e165-42ba-99c4-8138a545fce9\"", + "Id": "/subscriptions/59ac12a6-f2b7-46d4-af3d-98ba9d9dbd92/resourceGroups/ResourceGroup001/providers/Microsoft.Network/virtualNetworkGateways/Gateway001/natRules/natRule1" + } + ] +EnableBgpRouteTranslationForNat : True ``` The first command gets a virtual network gateway named Gateway01 that belongs to resource group ResourceGroup001 and stores it to the variable named $Gateway -The second command gets all the root certificates on VirtualNetworkGateway and save it to another variable $rootCerts -The third command shows total existing root certs on VirtualNetworkGateway. -The forth & fifth commands print root certificates at those corresponding indices for customer to see which ones they want to delete. -The sixth command removes expired root certificate by using that index e.g. here 1. Repeat same steps to remove multiple expired certificates from variable: $rootCerts -The seventh command updates VirtualNetworkGateway to set valid root certificates i.e. certificates that exists in variable: $rootCerts +The second command assigns the existing natrules into variable vngNatRules. +The third command assigns the value newly created PSVirtualNeyworkGatewayNatRule object natrule into variable natRule. +The fourth command add this PSVirtualNeyworkGatewayNatRule object into vngNatRules list. +The fifth command set this new created PSVirtualNetworkGatewayNatRule to NatRules of gateway and update the gateway. ## PARAMETERS diff --git a/src/RecoveryServices/RecoveryServices.Backup.Test/RecoveryServices.Backup.Test.csproj b/src/RecoveryServices/RecoveryServices.Backup.Test/RecoveryServices.Backup.Test.csproj index 362af9d29539..98de283b40ee 100644 --- a/src/RecoveryServices/RecoveryServices.Backup.Test/RecoveryServices.Backup.Test.csproj +++ b/src/RecoveryServices/RecoveryServices.Backup.Test/RecoveryServices.Backup.Test.csproj @@ -14,7 +14,7 @@ - + diff --git a/src/RecoveryServices/RecoveryServices.SiteRecovery.Test/RecoveryServices.SiteRecovery.Test.csproj b/src/RecoveryServices/RecoveryServices.SiteRecovery.Test/RecoveryServices.SiteRecovery.Test.csproj index 466db0c22311..a999153767cf 100644 --- a/src/RecoveryServices/RecoveryServices.SiteRecovery.Test/RecoveryServices.SiteRecovery.Test.csproj +++ b/src/RecoveryServices/RecoveryServices.SiteRecovery.Test/RecoveryServices.SiteRecovery.Test.csproj @@ -14,7 +14,7 @@ - +