Skip to content

Commit eba1de6

Browse files
wdehrichWill Ehrich
andauthored
Add edge zone parameter to virtual network cmdlet (#15196)
* 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 <[email protected]>
1 parent f1a8691 commit eba1de6

File tree

7 files changed

+1141
-16
lines changed

7 files changed

+1141
-16
lines changed

src/Network/Network.Test/ScenarioTests/VirtualNetworkTests.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,18 @@ public void TestVirtualNetworkPeeringSyncCRUD()
164164

165165
[Fact]
166166
[Trait(Category.AcceptanceType, Category.CheckIn)]
167+
[Trait(Category.Owner, NrpTeamAlias.sdnnrp)]
167168
public void TestVirtualNetworkInEdgeZone()
168169
{
169170
TestRunner.RunTestScript("Test-VirtualNetworkInEdgeZone");
170171
}
172+
173+
[Fact]
174+
[Trait(Category.AcceptanceType, Category.CheckIn)]
175+
[Trait(Category.Owner, NrpTeamAlias.sdnnrp)]
176+
public void TestVirtualNetworkEdgeZone()
177+
{
178+
TestRunner.RunTestScript("Test-VirtualNetworkEdgeZone");
179+
}
171180
}
172181
}

src/Network/Network.Test/ScenarioTests/VirtualNetworkTests.ps1

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1496,6 +1496,44 @@ function Test-VirtualNetworkInEdgeZone
14961496
finally
14971497
{
14981498
# Cleanup
1499-
Clean-ResourceGroup $ResourceGroup
1499+
Clean-ResourceGroup $ResourceGroupfunction Test-VirtualNetworkEdgeZone
1500+
}
1501+
}
1502+
1503+
<#
1504+
.SYNOPSIS
1505+
Test for creating a new virtual network in an edge zone. Subscriptions need to be explicitly whitelisted for access to edge zones.
1506+
#>
1507+
function Test-VirtualNetworkEdgeZone
1508+
{
1509+
# Setup
1510+
$rgname = Get-ResourceGroupName
1511+
$vnetName = Get-ResourceName
1512+
$subnetName = Get-ResourceName
1513+
$rglocation = "eastus2euap"
1514+
$resourceTypeParent = "Microsoft.Network/virtualNetworks"
1515+
$location = "eastus2euap"
1516+
1517+
try
1518+
{
1519+
# Create the resource group
1520+
$resourceGroup = New-AzResourceGroup -Name $rgname -Location $rglocation -Tags @{ testtag = "testval" }
1521+
1522+
# Create the Virtual Network
1523+
$subnet = New-AzVirtualNetworkSubnetConfig -Name $subnetName -AddressPrefix 10.0.1.0/24
1524+
New-AzVirtualNetwork -Name $vnetName -ResourceGroupName $rgname -Location $location -AddressPrefix 10.0.0.0/16 -DnsServer 8.8.8.8 -Subnet $subnet -EdgeZone "MicrosoftRRDCLab1"
1525+
$expected = Get-AzVirtualNetwork -Name $vnetName -ResourceGroupName $rgname
1526+
1527+
Assert-AreEqual $expected.ExtendedLocation.Name "MicrosoftRRDCLab1"
1528+
Assert-AreEqual $expected.ExtendedLocation.Type "EdgeZone"
1529+
}
1530+
catch [Microsoft.Azure.Commands.Network.Common.NetworkCloudException]
1531+
{
1532+
Assert-NotNull { $_.Exception.Message -match 'Resource type .* does not support edge zone .* in location .* The supported edge zones are .*' }
1533+
}
1534+
finally
1535+
{
1536+
# Cleanup
1537+
Clean-ResourceGroup $rgname
15001538
}
15011539
}

0 commit comments

Comments
 (0)