Skip to content

Commit

Permalink
Enable viewing of Public IP address extended location (#15230)
Browse files Browse the repository at this point in the history
* Add edge zone parameter to public ip address cmdlet

* Style issue

* Simple change to retrigger CI

* Fix indentation issue

* Updated change log

Co-authored-by: Will Ehrich <[email protected]>
Co-authored-by: Beisi Zhou <[email protected]>
  • Loading branch information
3 people authored Jun 11, 2021
1 parent 39e61ea commit 4668bff
Show file tree
Hide file tree
Showing 5 changed files with 233 additions and 216 deletions.
38 changes: 21 additions & 17 deletions src/Network/Network.Test/ScenarioTests/PublicIpAddressTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -819,32 +819,36 @@ function Test-PublicIpAddressCRUD-IdleTimeout

<#
.SYNOPSIS
Tests creating new simple publicIpAddress.
Test for creating a new simple publicIpAddress in an edge zone. Subscriptions need to be explicitly whitelisted for access to edge zones.
#>
function Test-PublicIpAddressInEdgeZone
{
# Setup
$ResourceName = Get-ResourceName
$resourceName = Get-ResourceName
$domainNameLabel = Get-ResourceName
$ResourceGroupName = Get-ResourceGroupName;
$LocationName = "westus";
$EdgeZone = "microsoftlosangeles1";
$VMName = "MyVM";

try
{
# Create the resource group
New-AzResourceGroup -Name $ResourceGroupName -Location $LocationName

# Create publicIpAddres
New-AzPublicIpAddress -ResourceGroupName $ResourceGroupName -Name $ResourceName -Location $LocationName -EdgeZone $EdgeZone -AllocationMethod Dynamic -DomainNameLabel $domainNameLabel
$resourceGroupName = Get-ResourceGroupName
$locationName = 'westus'
$edgeZone = 'microsoftlosangeles1'

$publicIP = Get-AzPublicIpAddress -Name $ResourceName -ResourceGroupName $ResourceGroupName
Assert-AreEqual $publicIP.ExtendedLocation.Name $EdgeZone
try
{
# Create the resource group
New-AzResourceGroup -Name $resourceGroupName -Location $locationName

# Create publicIpAddres
New-AzPublicIpAddress -ResourceGroupName $resourceGroupName -Name $resourceName -Location $locationName -EdgeZone $edgeZone -AllocationMethod Dynamic -DomainNameLabel $domainNameLabel

$publicIP = Get-AzPublicIpAddress -Name $resourceName -ResourceGroupName $resourceGroupName
Assert-AreEqual $publicIP.ExtendedLocation.Name $edgeZone
Assert-AreEqual $publicIP.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 $ResourceGroupName
Clean-ResourceGroup $resourceGroupName
}
}
Loading

0 comments on commit 4668bff

Please sign in to comment.