Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add edge zone parameter to virtual network cmdlet #15196

Merged
merged 11 commits into from
Jun 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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