Skip to content

Commit 4668bff

Browse files
wdehrichWill EhrichBethanyZhou
authored
Enable viewing of Public IP address extended location (#15230)
* 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]>
1 parent 39e61ea commit 4668bff

File tree

5 files changed

+233
-216
lines changed

5 files changed

+233
-216
lines changed

src/Network/Network.Test/ScenarioTests/PublicIpAddressTests.ps1

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -819,32 +819,36 @@ function Test-PublicIpAddressCRUD-IdleTimeout
819819

820820
<#
821821
.SYNOPSIS
822-
Tests creating new simple publicIpAddress.
822+
Test for creating a new simple publicIpAddress in an edge zone. Subscriptions need to be explicitly whitelisted for access to edge zones.
823823
#>
824824
function Test-PublicIpAddressInEdgeZone
825825
{
826826
# Setup
827-
$ResourceName = Get-ResourceName
827+
$resourceName = Get-ResourceName
828828
$domainNameLabel = Get-ResourceName
829-
$ResourceGroupName = Get-ResourceGroupName;
830-
$LocationName = "westus";
831-
$EdgeZone = "microsoftlosangeles1";
832-
$VMName = "MyVM";
833-
834-
try
835-
{
836-
# Create the resource group
837-
New-AzResourceGroup -Name $ResourceGroupName -Location $LocationName
838-
839-
# Create publicIpAddres
840-
New-AzPublicIpAddress -ResourceGroupName $ResourceGroupName -Name $ResourceName -Location $LocationName -EdgeZone $EdgeZone -AllocationMethod Dynamic -DomainNameLabel $domainNameLabel
829+
$resourceGroupName = Get-ResourceGroupName
830+
$locationName = 'westus'
831+
$edgeZone = 'microsoftlosangeles1'
841832

842-
$publicIP = Get-AzPublicIpAddress -Name $ResourceName -ResourceGroupName $ResourceGroupName
843-
Assert-AreEqual $publicIP.ExtendedLocation.Name $EdgeZone
833+
try
834+
{
835+
# Create the resource group
836+
New-AzResourceGroup -Name $resourceGroupName -Location $locationName
837+
838+
# Create publicIpAddres
839+
New-AzPublicIpAddress -ResourceGroupName $resourceGroupName -Name $resourceName -Location $locationName -EdgeZone $edgeZone -AllocationMethod Dynamic -DomainNameLabel $domainNameLabel
840+
841+
$publicIP = Get-AzPublicIpAddress -Name $resourceName -ResourceGroupName $resourceGroupName
842+
Assert-AreEqual $publicIP.ExtendedLocation.Name $edgeZone
843+
Assert-AreEqual $publicIP.ExtendedLocation.Type 'EdgeZone'
844+
}
845+
catch [Microsoft.Azure.Commands.Network.Common.NetworkCloudException]
846+
{
847+
Assert-NotNull { $_.Exception.Message -match 'Resource type .* does not support edge zone .* in location .* The supported edge zones are .*' }
844848
}
845849
finally
846850
{
847851
# Cleanup
848-
Clean-ResourceGroup $ResourceGroupName
852+
Clean-ResourceGroup $resourceGroupName
849853
}
850854
}

0 commit comments

Comments
 (0)