Skip to content

Commit

Permalink
Add edge zone parameter to virtual network cmdlet (#15196)
Browse files Browse the repository at this point in the history
* Update virtual network cmdlet

* Create PSExtendedLocation.cs

* Unit test is working

* Add session record

* Fix help message and change formatting

* Update test session record

* Add catch block to test

* Fix build error introduced during rebase

* UT metadata

* Run commands synchronously and upload new test session record

* Fix static analysis issue

Co-authored-by: Will Ehrich <william.ehrich@microsoft.com>
  • Loading branch information
wdehrich and Will Ehrich authored Jun 9, 2021
1 parent f1a8691 commit eba1de6
Show file tree
Hide file tree
Showing 7 changed files with 1,141 additions and 16 deletions.
9 changes: 9 additions & 0 deletions src/Network/Network.Test/ScenarioTests/VirtualNetworkTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,18 @@ public void TestVirtualNetworkPeeringSyncCRUD()

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
[Trait(Category.Owner, NrpTeamAlias.sdnnrp)]
public void TestVirtualNetworkInEdgeZone()
{
TestRunner.RunTestScript("Test-VirtualNetworkInEdgeZone");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
[Trait(Category.Owner, NrpTeamAlias.sdnnrp)]
public void TestVirtualNetworkEdgeZone()
{
TestRunner.RunTestScript("Test-VirtualNetworkEdgeZone");
}
}
}
40 changes: 39 additions & 1 deletion src/Network/Network.Test/ScenarioTests/VirtualNetworkTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1496,6 +1496,44 @@ function Test-VirtualNetworkInEdgeZone
finally
{
# Cleanup
Clean-ResourceGroup $ResourceGroup
Clean-ResourceGroup $ResourceGroupfunction Test-VirtualNetworkEdgeZone
}
}

<#
.SYNOPSIS
Test for creating a new virtual network in an edge zone. Subscriptions need to be explicitly whitelisted for access to edge zones.
#>
function Test-VirtualNetworkEdgeZone
{
# Setup
$rgname = Get-ResourceGroupName
$vnetName = Get-ResourceName
$subnetName = Get-ResourceName
$rglocation = "eastus2euap"
$resourceTypeParent = "Microsoft.Network/virtualNetworks"
$location = "eastus2euap"

try
{
# Create the resource group
$resourceGroup = New-AzResourceGroup -Name $rgname -Location $rglocation -Tags @{ testtag = "testval" }

# Create the Virtual Network
$subnet = New-AzVirtualNetworkSubnetConfig -Name $subnetName -AddressPrefix 10.0.1.0/24
New-AzVirtualNetwork -Name $vnetName -ResourceGroupName $rgname -Location $location -AddressPrefix 10.0.0.0/16 -DnsServer 8.8.8.8 -Subnet $subnet -EdgeZone "MicrosoftRRDCLab1"
$expected = Get-AzVirtualNetwork -Name $vnetName -ResourceGroupName $rgname

Assert-AreEqual $expected.ExtendedLocation.Name "MicrosoftRRDCLab1"
Assert-AreEqual $expected.ExtendedLocation.Type "EdgeZone"
}
catch [Microsoft.Azure.Commands.Network.Common.NetworkCloudException]
{
Assert-NotNull { $_.Exception.Message -match 'Resource type .* does not support edge zone .* in location .* The supported edge zones are .*' }
}
finally
{
# Cleanup
Clean-ResourceGroup $rgname
}
}
Loading

0 comments on commit eba1de6

Please sign in to comment.