Test-​Azure​Rm​Network​Watcher​IP​Flow

Returns whether the packet is allowed or denied to or from a particular destination.

Syntax

Test-AzureRmNetworkWatcherIPFlow
    -Direction <String>
    -LocalIPAddress <String>
    -LocalPort <String>
    -NetworkWatcher <PSNetworkWatcher>
    -Protocol <String>
    -RemoteIPAddress <String>
    [-RemotePort <String>]
    [-TargetNetworkInterfaceId <String>]
    -TargetVirtualMachineId <String>
    [<CommonParameters>]
Test-AzureRmNetworkWatcherIPFlow
    -Direction <String>
    -LocalIPAddress <String>
    -LocalPort <String>
    -NetworkWatcherName <String>
    -Protocol <String>
    -RemoteIPAddress <String>
    [-RemotePort <String>]
    -ResourceGroupName <String>
    [-TargetNetworkInterfaceId <String>]
    -TargetVirtualMachineId <String>
    [<CommonParameters>]

Description

The Test-AzureRmNetworkWatcherIPFlow cmdlet, for a specified VM resource and a packet with specified direction using local and remote, IP addresses and ports, returns whether the packet is allowed or denied.

Examples

--- Example 1: Run Test-AzureRmNetworkWatcherIPFlow ---

$nw = Get-AzurermResource | Where {$_.ResourceType -eq "Microsoft.Network/networkWatchers" -and $_.Location -eq "WestCentralUS" } 
$networkWatcher = Get-AzureRmNetworkWatcher -Name $nw.Name -ResourceGroupName $nw.ResourceGroupName 
$VM = Get-AzurermVM -ResourceGroupName testResourceGroup -Name VM0 
$Nics = Get-AzureRmNetworkInterface | Where {$_.Id -eq $vm.NetworkInterfaceIDs.ForEach({$_})}

Test-AzureRmNetworkWatcherIPFlow -NetworkWatcher $networkWatcher -TargetVirtualMachineId $VM.Id -Direction Outbound -Protocol TCP -LocalIPAddress $nics[0].IpConfigurations[0].PrivateIpAddress -LocalPort 6895 -RemoteIPAddress 204.79.197.200 -RemotePort 80

Get's the Network Watcher in West Central US for this subscription, then gets the VM and it's associated Network Interfaces. Then for the first Network Interface, runs Test-AzureRmNetworkWatcherIPFlow using the first IP from the first Network Interface for an outbound connection to an IP on the internet.

Required Parameters

-Direction

Direction.

Type:String
Parameter Sets:Inbound, Outbound
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-LocalIPAddress

Local IP Address.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-LocalPort

Local Port.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-NetworkWatcher

The network watcher resource.

Type:PSNetworkWatcher
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-NetworkWatcherName

The name of network watcher.

Type:String
Aliases:Name
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-Protocol

Protocol.

Type:String
Parameter Sets:TCP, UDP
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-RemoteIPAddress

Remote IP Address.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-ResourceGroupName

The name of the network watcher resource group.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-TargetVirtualMachineId

The target virtual machine ID.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False

Optional Parameters

-RemotePort

Remote port.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-TargetNetworkInterfaceId

Target network interface Id.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Inputs

Microsoft.Azure.Commands.Network.Models.PSNetworkWatcher

System.String

Outputs

Microsoft.Azure.Commands.Network.Models.PSIPFlowVerifyResult

Notes

Keywords: azure, azurerm, arm, resource, management, manager, network, networking, network watcher, flow, ip