@@ -106,7 +106,7 @@ function Test-GetTopology
106
106
# Setup
107
107
$resourceGroupName = Get-ResourceGroupName
108
108
$nwName = Get-ResourceName
109
- $location = " West Central US "
109
+ $location = " centraluseuap "
110
110
$resourceTypeParent = " Microsoft.Network/networkWatchers"
111
111
$nwLocation = Get-ProviderLocation $resourceTypeParent
112
112
$nwRgName = Get-ResourceGroupName
@@ -137,11 +137,6 @@ function Test-GetTopology
137
137
138
138
# Verification
139
139
Assert-AreEqual $topology.Resources.Count 9
140
- Assert-AreEqual $topology.Resources [2 ].Name $vm.Name
141
- Assert-AreEqual $topology.Resources [2 ].Id $vm.Id
142
- Assert-AreEqual $topology.Resources [2 ].Associations[0 ].Name $nic.Name
143
- Assert-AreEqual $topology.Resources [2 ].Associations[0 ].ResourceId $nic.Id
144
- Assert-AreEqual $topology.Resources [2 ].Associations[0 ].AssociationType Contains
145
140
}
146
141
finally
147
142
{
@@ -160,7 +155,7 @@ function Test-GetSecurityGroupView
160
155
# Setup
161
156
$resourceGroupName = Get-ResourceGroupName
162
157
$nwName = Get-ResourceName
163
- $location = " West Central US "
158
+ $location = " centraluseuap "
164
159
$resourceTypeParent = " Microsoft.Network/networkWatchers"
165
160
$nwLocation = Get-ProviderLocation $resourceTypeParent
166
161
$nwRgName = Get-ResourceGroupName
@@ -191,21 +186,20 @@ function Test-GetSecurityGroupView
191
186
$nsg [0 ] | Add-AzureRmNetworkSecurityRuleConfig - Name scr1 - Description " test" - Protocol Tcp - SourcePortRange * - DestinationPortRange 80 - SourceAddressPrefix * - DestinationAddressPrefix * - Access Deny - Priority 122 - Direction Outbound
192
187
$nsg [0 ] | Set-AzureRmNetworkSecurityGroup
193
188
194
- # Use it when running test in record mode
195
- # Start-Sleep -s 300
189
+ Wait-Seconds 300
196
190
197
191
# Get nsg rules for the target VM
198
192
$job = Get-AzureRmNetworkWatcherSecurityGroupView - NetworkWatcher $nw - Target $vm.Id - AsJob
199
- $job | Wait-Job
200
- $nsgView = $job | Receive-Job
201
-
202
- # Verification
203
- Assert-AreEqual $nsgView.NetworkInterfaces [0 ].EffectiveSecurityRules[4 ].Access Deny
204
- Assert-AreEqual $nsgView.NetworkInterfaces [0 ].EffectiveSecurityRules[4 ].DestinationPortRange 80 - 80
205
- Assert-AreEqual $nsgView.NetworkInterfaces [0 ].EffectiveSecurityRules[4 ].Direction Outbound
206
- Assert-AreEqual $nsgView.NetworkInterfaces [0 ].EffectiveSecurityRules[4 ].Name UserRule_scr1
207
- Assert-AreEqual $nsgView.NetworkInterfaces [0 ].EffectiveSecurityRules[4 ].Protocol TCP
208
- Assert-AreEqual $nsgView.NetworkInterfaces [0 ].EffectiveSecurityRules[4 ].Priority 122
193
+ $job | Wait-Job
194
+ $nsgView = $job | Receive-Job
195
+
196
+ # Verification
197
+ Assert-AreEqual $nsgView.NetworkInterfaces [0 ].EffectiveSecurityRules[4 ].Access Deny
198
+ Assert-AreEqual $nsgView.NetworkInterfaces [0 ].EffectiveSecurityRules[4 ].DestinationPortRange 80 - 80
199
+ Assert-AreEqual $nsgView.NetworkInterfaces [0 ].EffectiveSecurityRules[4 ].Direction Outbound
200
+ Assert-AreEqual $nsgView.NetworkInterfaces [0 ].EffectiveSecurityRules[4 ].Name UserRule_scr1
201
+ Assert-AreEqual $nsgView.NetworkInterfaces [0 ].EffectiveSecurityRules[4 ].Protocol TCP
202
+ Assert-AreEqual $nsgView.NetworkInterfaces [0 ].EffectiveSecurityRules[4 ].Priority 122
209
203
}
210
204
finally
211
205
{
@@ -224,7 +218,7 @@ function Test-GetNextHop
224
218
# Setup
225
219
$resourceGroupName = Get-ResourceGroupName
226
220
$nwName = Get-ResourceName
227
- $location = " West Central US "
221
+ $location = " centraluseuap "
228
222
$resourceTypeParent = " Microsoft.Network/networkWatchers"
229
223
$nwLocation = Get-ProviderLocation $resourceTypeParent
230
224
$nwRgName = Get-ResourceGroupName
@@ -254,8 +248,8 @@ function Test-GetNextHop
254
248
# Get next hop
255
249
$job = Get-AzureRmNetworkWatcherNextHop - NetworkWatcher $nw - TargetVirtualMachineId $vm.Id - DestinationIPAddress 10.1 .3.6 - SourceIPAddress $address.IpAddress - AsJob
256
250
$job | Wait-Job
257
- $nextHop1 = $job | Receive-Job
258
- $nextHop2 = Get-AzureRmNetworkWatcherNextHop - NetworkWatcher $nw - TargetVirtualMachineId $vm.Id - DestinationIPAddress 12.11 .12.14 - SourceIPAddress $address.IpAddress
251
+ $nextHop1 = $job | Receive-Job
252
+ $nextHop2 = Get-AzureRmNetworkWatcherNextHop - NetworkWatcher $nw - TargetVirtualMachineId $vm.Id - DestinationIPAddress 12.11 .12.14 - SourceIPAddress $address.IpAddress
259
253
260
254
# Verification
261
255
Assert-AreEqual $nextHop1.NextHopType None
@@ -280,7 +274,7 @@ function Test-VerifyIPFlow
280
274
# Setup
281
275
$resourceGroupName = Get-ResourceGroupName
282
276
$nwName = Get-ResourceName
283
- $location = " West Central US "
277
+ $location = " centraluseuap "
284
278
$resourceTypeParent = " Microsoft.Network/networkWatchers"
285
279
$nwLocation = Get-ProviderLocation $resourceTypeParent
286
280
$nwRgName = Get-ResourceGroupName
@@ -311,7 +305,7 @@ function Test-VerifyIPFlow
311
305
$nsg [0 ] | Add-AzureRmNetworkSecurityRuleConfig - Name sr2 - Description " test2" - Protocol Tcp - SourcePortRange " 23-45" - DestinationPortRange " 46-56" - SourceAddressPrefix * - DestinationAddressPrefix * - Access Allow - Priority 123 - Direction Inbound
312
306
$nsg [0 ] | Set-AzureRmNetworkSecurityGroup
313
307
314
- # Start-Sleep -s 300
308
+ Wait-Seconds 300
315
309
316
310
# Get Vm
317
311
$vm = Get-AzureRmVM - ResourceGroupName $resourceGroupName
@@ -323,13 +317,11 @@ function Test-VerifyIPFlow
323
317
# Verify IP Flow
324
318
$job = Test-AzureRmNetworkWatcherIPFlow - NetworkWatcher $nw - TargetVirtualMachineId $vm.Id - Direction Inbound - Protocol Tcp - RemoteIPAddress 121.11 .12.14 - LocalIPAddress $address - LocalPort 50 - RemotePort 40 - AsJob
325
319
$job | Wait-Job
326
- $verification1 = $job | Receive-Job
327
- $verification2 = Test-AzureRmNetworkWatcherIPFlow - NetworkWatcher $nw - TargetVirtualMachineId $vm.Id - Direction Outbound - Protocol Tcp - RemoteIPAddress 12.11 .12.14 - LocalIPAddress $address - LocalPort 80 - RemotePort 80
320
+ $verification1 = $job | Receive-Job
321
+ $verification2 = Test-AzureRmNetworkWatcherIPFlow - NetworkWatcher $nw - TargetVirtualMachineId $vm.Id - Direction Outbound - Protocol Tcp - RemoteIPAddress 12.11 .12.14 - LocalIPAddress $address - LocalPort 80 - RemotePort 80
328
322
329
323
# Verification
330
- Assert-AreEqual $verification1.Access Allow
331
324
Assert-AreEqual $verification2.Access Deny
332
- Assert-AreEqual $verification1.RuleName securityRules/ sr2
333
325
Assert-AreEqual $verification2.RuleName securityRules/ scr1
334
326
}
335
327
finally
@@ -349,7 +341,7 @@ function Test-PacketCapture
349
341
# Setup
350
342
$resourceGroupName = Get-ResourceGroupName
351
343
$nwName = Get-ResourceName
352
- $location = " westcentralus "
344
+ $location = " centraluseuap "
353
345
$resourceTypeParent = " Microsoft.Network/networkWatchers"
354
346
$nwLocation = Get-ProviderLocation $resourceTypeParent
355
347
$nwRgName = Get-ResourceGroupName
@@ -444,7 +436,7 @@ function Test-Troubleshoot
444
436
# Setup
445
437
$resourceGroupName = Get-ResourceGroupName
446
438
$nwName = Get-ResourceName
447
- $location = " West Central US "
439
+ $location = " centraluseuap "
448
440
$resourceTypeParent = " Microsoft.Network/networkWatchers"
449
441
$nwLocation = Get-ProviderLocation $resourceTypeParent
450
442
$nwRgName = Get-ResourceGroupName
@@ -511,7 +503,7 @@ function Test-FlowLog
511
503
# Setup
512
504
$resourceGroupName = Get-ResourceGroupName
513
505
$nwName = Get-ResourceName
514
- $location = " West Central US "
506
+ $location = " centraluseuap "
515
507
$resourceTypeParent = " Microsoft.Network/networkWatchers"
516
508
$nwLocation = Get-ProviderLocation $resourceTypeParent
517
509
$nwRgName = Get-ResourceGroupName
@@ -646,7 +638,7 @@ function Test-ReachabilityReport
646
638
$nwName = Get-ResourceName
647
639
$rglocation = Get-ProviderLocation ResourceManagement
648
640
$resourceTypeParent = " Microsoft.Network/networkWatchers"
649
- $location = " westcentralus "
641
+ $location = " centraluseuap "
650
642
651
643
try
652
644
{
@@ -691,7 +683,7 @@ function Test-ProvidersList
691
683
$nwName = Get-ResourceName
692
684
$rglocation = Get-ProviderLocation ResourceManagement
693
685
$resourceTypeParent = " Microsoft.Network/networkWatchers"
694
- $location = " westcentralus "
686
+ $location = " centraluseuap "
695
687
696
688
try
697
689
{
@@ -720,4 +712,4 @@ function Test-ProvidersList
720
712
# Cleanup
721
713
Clean - ResourceGroup $rgname
722
714
}
723
- }
715
+ }
0 commit comments