Get-​Azure​Rm​Network​Watcher​Packet​Capture

Gets information and properties and status of a packet capture resource.

Syntax

Get-AzureRmNetworkWatcherPacketCapture
   -NetworkWatcher <PSNetworkWatcher>
   [-PacketCaptureName <String>]
   [<CommonParameters>]
Get-AzureRmNetworkWatcherPacketCapture
   -NetworkWatcherName <String>
   [-PacketCaptureName <String>]
   -ResourceGroupName <String>
   [<CommonParameters>]

Description

The Get-AzureRmNetworkWatcherPacketCapture gets the properties and status of a packet capture resource.

Examples

--- Example 1: Create a Packet Capture with multiple filters and retrieve its status ---

$nw = Get-AzurermResource | Where {$_.ResourceType -eq "Microsoft.Network/networkWatchers" -and $_.Location -eq "WestCentralUS" } 
$networkWatcher = Get-AzureRmNetworkWatcher -Name $nw.Name -ResourceGroupName $nw.ResourceGroupName 

$storageAccount = Get-AzureRmStorageAccount -ResourceGroupName contosoResourceGroup -Name contosostorage123

$filter1 = New-AzureRmPacketCaptureFilterConfig -Protocol TCP -RemoteIPAddress "1.1.1.1-255.255.255" -LocalIPAddress "10.0.0.3" -LocalPort "1-65535" -RemotePort "20;80;443"
$filter2 = New-AzureRmPacketCaptureFilterConfig -Protocol UDP 
New-AzureRmNetworkWatcherPacketCapture -NetworkWatcher $networkWatcher -TargetVirtualMachineId $vm.Id -PacketCaptureName "PacketCaptureTest" -StorageAccountId $storageAccount.id -TimeLimitInSeconds 60 -Filters $filter1, $filter2

Get-AzureRmNetworkWatcherPacketCapture -NetworkWatcher $networkWatcher -PacketCaptureName "PacketCaptureTest"

In this example we create a packet capture named "PacketCaptureTest" with multiple filters and a time limit. Once the session is complete, it will be saved to the specified storage account. We then call Get-AzureRmNetworkWatcherPacketCapture to retrieve the status of the capture session.

Note: The Azure Network Watcher extension must be installed on the target virtual machine to create packet captures.

Required Parameters

-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
-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

Optional Parameters

-PacketCaptureName

The packet capture name.

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.PSGetPacketCaptureResult

Notes

Keywords: azure, azurerm, arm, resource, management, manager, network, networking, network watcher, packet, capture, traffic