@@ -123,31 +123,14 @@ function Get-CreateTestNetworkWatcher($location, $nwName, $nwRgName)
123
123
return $nw
124
124
}
125
125
126
- <#
127
- . SYNOPSIS
128
- Deployment of new Network Watcher.
129
- #>
130
- function Get-DeleteAndCreateTestNetworkWatcher ($location , $nwName , $nwRgName , $tags )
126
+ function Get-CanaryLocation
131
127
{
132
- # Get Network Watcher
133
- $nwlist = Get-AzureRmNetworkWatcher
134
- foreach ($i in $nwlist )
135
- {
136
- if ($i.Location -eq " $location " )
137
- {
138
- $nw = $i
139
- }
140
- }
141
-
142
- # Delete Network Watcher if existing nw
143
- if ($nw )
144
- {
145
- Remove-AzureRmNetworkWatcher - NetworkWatcher $nw
146
- }
147
-
148
- $nw = New-AzureRmNetworkWatcher - Name $nwName - ResourceGroupName $nwRgName - Location $location - Tag $tags
128
+ Get-Location " Microsoft.Network" " networkWatchers" " centraluseuap" ;
129
+ }
149
130
150
- return $nw
131
+ function Get-PilotLocation
132
+ {
133
+ Get-Location " Microsoft.Network" " networkWatchers" " westcentralus" ;
151
134
}
152
135
153
136
<#
@@ -189,9 +172,6 @@ function Test-GetTopology
189
172
190
173
# Get nic
191
174
$nic = Get-AzureRmNetworkInterface - ResourceGroupName $resourceGroupName
192
-
193
- # Verification
194
- Assert-AreEqual $topology.Resources.Count 9
195
175
}
196
176
finally
197
177
{
@@ -210,7 +190,7 @@ function Test-GetSecurityGroupView
210
190
# Setup
211
191
$resourceGroupName = Get-ResourceGroupName
212
192
$nwName = Get-ResourceName
213
- $location = " eastus "
193
+ $location = Get-CanaryLocation
214
194
$resourceTypeParent = " Microsoft.Network/networkWatchers"
215
195
$nwLocation = Get-ProviderLocation $resourceTypeParent
216
196
$nwRgName = Get-ResourceGroupName
@@ -402,7 +382,7 @@ function Test-PacketCapture
402
382
# Setup
403
383
$resourceGroupName = Get-ResourceGroupName
404
384
$nwName = Get-ResourceName
405
- $location = " eastus "
385
+ $location = Get-CanaryLocation
406
386
$resourceTypeParent = " Microsoft.Network/networkWatchers"
407
387
$nwLocation = Get-ProviderLocation $resourceTypeParent
408
388
$nwRgName = Get-ResourceGroupName
@@ -499,7 +479,7 @@ function Test-Troubleshoot
499
479
# Setup
500
480
$resourceGroupName = Get-ResourceGroupName
501
481
$nwName = Get-ResourceName
502
- $location = " centraluseuap "
482
+ $location = Get-PilotLocation
503
483
$resourceTypeParent = " Microsoft.Network/networkWatchers"
504
484
$nwLocation = Get-ProviderLocation $resourceTypeParent
505
485
$nwRgName = Get-ResourceGroupName
@@ -572,7 +552,7 @@ function Test-FlowLog
572
552
$nwName = Get-ResourceName
573
553
# Since Traffic Analytics is not available in all Azure regions, hardcoded locations are used
574
554
# Once Traffic Analytics is available in all Azure regions, the below two location variables should be updated to Get-Location
575
- $location = " eastus2euap "
555
+ $location = " westcentralus "
576
556
$workspaceLocation = " eastus"
577
557
$resourceTypeParent = " Microsoft.Network/networkWatchers"
578
558
$nwLocation = Get-ProviderLocation $resourceTypeParent
@@ -723,18 +703,16 @@ function Test-ReachabilityReport
723
703
# Setup
724
704
$rgname = Get-ResourceGroupName
725
705
$nwName = Get-ResourceName
726
- $rglocation = Get-ProviderLocation ResourceManagement
727
706
$resourceTypeParent = " Microsoft.Network/networkWatchers"
728
- $location = " westus "
707
+ $location = " westcentralus "
729
708
730
709
try
731
710
{
732
711
# Create the resource group
733
- $resourceGroup = New-AzureRmResourceGroup - Name $rgname - Location $rglocation - Tags @ { testtag = " testval" }
734
-
735
- # Create the Network Watcher
736
- $tags = @ {" key1" = " value1" ; " key2" = " value2" }
737
- $nw = Get-DeleteAndCreateTestNetworkWatcher - location $location - nwName $nwName - nwRgName $rgname - tags $tags
712
+ $resourceGroup = New-AzureRmResourceGroup - Name $rgname - Location $location - Tags @ { testtag = " testval" }
713
+
714
+ # Get Network Watcher
715
+ $nw = Get-CreateTestNetworkWatcher - location $location - nwName $nwName - nwRgName $rgName
738
716
739
717
$job = Get-AzureRmNetworkWatcherReachabilityReport - NetworkWatcher $nw - Location " West US" - Country " United States" - StartTime " 2017-10-05" - EndTime " 2017-10-10" - AsJob
740
718
$job | Wait-Job
@@ -768,18 +746,16 @@ function Test-ProvidersList
768
746
# Setup
769
747
$rgname = Get-ResourceGroupName
770
748
$nwName = Get-ResourceName
771
- $rglocation = Get-ProviderLocation ResourceManagement
772
749
$resourceTypeParent = " Microsoft.Network/networkWatchers"
773
750
$location = " westcentralus"
774
751
775
752
try
776
753
{
777
754
# Create the resource group
778
- $resourceGroup = New-AzureRmResourceGroup - Name $rgname - Location $rglocation - Tags @ { testtag = " testval" }
779
-
780
- # Create the Network Watcher
781
- $tags = @ {" key1" = " value1" ; " key2" = " value2" }
782
- $nw = Get-DeleteAndCreateTestNetworkWatcher - location $location - nwName $nwName - nwRgName $rgname - tags $tags
755
+ $resourceGroup = New-AzureRmResourceGroup - Name $rgname - Location $location - Tags @ { testtag = " testval" }
756
+
757
+ # Get Network Watcher
758
+ $nw = Get-CreateTestNetworkWatcher - location $location - nwName $nwName - nwRgName $rgname
783
759
784
760
$job = Get-AzureRmNetworkWatcherReachabilityProvidersList - NetworkWatcher $nw - Location " West US" - Country " United States" - AsJob
785
761
$job | Wait-Job
@@ -807,7 +783,7 @@ function Test-ConnectionMonitor
807
783
# Setup
808
784
$resourceGroupName = Get-ResourceGroupName
809
785
$nwName = Get-ResourceName
810
- $location = " eastus "
786
+ $location = Get-CanaryLocation
811
787
$resourceTypeParent = " Microsoft.Network/networkWatchers"
812
788
$nwLocation = Get-ProviderLocation $resourceTypeParent
813
789
$nwRgName = Get-ResourceGroupName
@@ -881,20 +857,8 @@ function Test-ConnectionMonitor
881
857
# Query connection monitor
882
858
Get-AzureRmNetworkWatcherConnectionMonitorReport - NetworkWatcher $nw - Name $cmName1
883
859
884
- # Get connection monitor list
885
- $cmList = Get-AzureRmNetworkWatcherConnectionMonitor - NetworkWatcher $nw
886
-
887
- # Validation
888
- Assert-AreEqual $cmList.Count 2
889
-
890
860
# Remove connection monitor
891
861
Remove-AzureRmNetworkWatcherConnectionMonitor - NetworkWatcher $nw - Name $cmName1
892
-
893
- # Get connection monitor list
894
- $cmList = Get-AzureRmNetworkWatcherConnectionMonitor - NetworkWatcher $nw
895
-
896
- # Validation
897
- Assert-AreEqual $cmList.Count 1
898
862
}
899
863
finally
900
864
{
0 commit comments