Share via


Packet Captures - Get

Gets a packet capture session by name.

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}?api-version=2024-05-01

URI Parameters

Name In Required Type Description
networkWatcherName
path True

string

The name of the network watcher.

packetCaptureName
path True

string

The name of the packet capture session.

resourceGroupName
path True

string

The name of the resource group.

subscriptionId
path True

string

The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.

api-version
query True

string

Client API version.

Responses

Name Type Description
200 OK

PacketCaptureResult

Request successful. The operation returns a packet capture session.

Other Status Codes

ErrorResponse

Error response describing why the operation failed.

Security

azure_auth

Azure Active Directory OAuth2 Flow.

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation impersonate your user account

Examples

Get packet capture

Sample request

GET https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkWatchers/nw1/packetCaptures/pc1?api-version=2024-05-01

Sample response

{
  "name": "pc1",
  "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkWatchers/nw1/packetCaptures/pc1",
  "etag": "W/\"00000000-0000-0000-0000-000000000000\"",
  "properties": {
    "provisioningState": "Updating",
    "target": "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Compute/virtualMachines/vm1",
    "bytesToCapturePerPacket": 10000,
    "totalBytesPerSession": 100000,
    "timeLimitInSeconds": 100,
    "storageLocation": {
      "storageId": "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Storage/storageAccounts/pcstore",
      "storagePath": "https://mytestaccountname.blob.core.windows.net/capture/pc1.cap",
      "filePath": "D:\\capture\\pc1.cap"
    },
    "filters": [
      {
        "protocol": "TCP",
        "localIPAddress": "10.0.0.4",
        "localPort": "80"
      }
    ]
  }
}

Definitions

Name Description
ErrorDetails

Common error details representation.

ErrorResponse

The error object.

PacketCaptureFilter

Filter that is applied to packet capture request. Multiple filters can be applied.

PacketCaptureMachineScope

A list of AzureVMSS instances which can be included or excluded to run packet capture. If both included and excluded are empty, then the packet capture will run on all instances of AzureVMSS.

PacketCaptureResult

Information about packet capture session.

PacketCaptureSettings

The storage location for a packet capture session.

PacketCaptureStorageLocation

The storage location for a packet capture session.

PacketCaptureTargetType

Target type of the resource provided.

PcProtocol

Protocol to be filtered on.

ProvisioningState

The current provisioning state.

ErrorDetails

Common error details representation.

Name Type Description
code

string

Error code.

message

string

Error message.

target

string

Error target.

ErrorResponse

The error object.

Name Type Description
error

ErrorDetails

Error
The error details object.

PacketCaptureFilter

Filter that is applied to packet capture request. Multiple filters can be applied.

Name Type Default value Description
localIPAddress

string

Local IP Address to be filtered on. Notation: "127.0.0.1" for single address entry. "127.0.0.1-127.0.0.255" for range. "127.0.0.1;127.0.0.5"? for multiple entries. Multiple ranges not currently supported. Mixing ranges with multiple entries not currently supported. Default = null.

localPort

string

Local port to be filtered on. Notation: "80" for single port entry."80-85" for range. "80;443;" for multiple entries. Multiple ranges not currently supported. Mixing ranges with multiple entries not currently supported. Default = null.

protocol

PcProtocol

Any

Protocol to be filtered on.

remoteIPAddress

string

Local IP Address to be filtered on. Notation: "127.0.0.1" for single address entry. "127.0.0.1-127.0.0.255" for range. "127.0.0.1;127.0.0.5;" for multiple entries. Multiple ranges not currently supported. Mixing ranges with multiple entries not currently supported. Default = null.

remotePort

string

Remote port to be filtered on. Notation: "80" for single port entry."80-85" for range. "80;443;" for multiple entries. Multiple ranges not currently supported. Mixing ranges with multiple entries not currently supported. Default = null.

PacketCaptureMachineScope

A list of AzureVMSS instances which can be included or excluded to run packet capture. If both included and excluded are empty, then the packet capture will run on all instances of AzureVMSS.

Name Type Description
exclude

string[]

List of AzureVMSS instances which has to be excluded from the AzureVMSS from running packet capture.

include

string[]

List of AzureVMSS instances to run packet capture on.

PacketCaptureResult

Information about packet capture session.

Name Type Default value Description
etag

string

A unique read-only string that changes whenever the resource is updated.

id

string

ID of the packet capture operation.

name

string

Name of the packet capture session.

properties.bytesToCapturePerPacket

integer (int64)

minimum: 0
maximum: 4294967295
0

Number of bytes captured per packet, the remaining bytes are truncated.

properties.captureSettings

PacketCaptureSettings

The capture setting holds the 'FileCount', 'FileSizeInBytes', 'SessionTimeLimitInSeconds' values.

properties.continuousCapture

boolean

This continuous capture is a nullable boolean, which can hold 'null', 'true' or 'false' value. If we do not pass this parameter, it would be consider as 'null', default value is 'null'.

properties.filters

PacketCaptureFilter[]

A list of packet capture filters.

properties.provisioningState

ProvisioningState

The provisioning state of the packet capture session.

properties.scope

PacketCaptureMachineScope

A list of AzureVMSS instances which can be included or excluded to run packet capture. If both included and excluded are empty, then the packet capture will run on all instances of AzureVMSS.

properties.storageLocation

PacketCaptureStorageLocation

The storage location for a packet capture session.

properties.target

string

The ID of the targeted resource, only AzureVM and AzureVMSS as target type are currently supported.

properties.targetType

PacketCaptureTargetType

Target type of the resource provided.

properties.timeLimitInSeconds

integer (int32)

minimum: 0
maximum: 18000
18000

Maximum duration of the capture session in seconds.

properties.totalBytesPerSession

integer (int64)

minimum: 0
maximum: 4294967295
1073741824

Maximum size of the capture output.

PacketCaptureSettings

The storage location for a packet capture session.

Name Type Default value Description
fileCount

integer (int32)

minimum: 0
maximum: 10000
10

Number of file count. Default value of count is 10 and maximum number is 10000.

fileSizeInBytes

integer (int64)

minimum: 0
maximum: 4294967295
104857600

Number of bytes captured per packet. Default value in bytes 104857600 (100MB) and maximum in bytes 4294967295 (4GB).

sessionTimeLimitInSeconds

integer (int32)

minimum: 0
maximum: 604800
86400

Maximum duration of the capture session in seconds is 604800s (7 days) for a file. Default value in second 86400s (1 day).

PacketCaptureStorageLocation

The storage location for a packet capture session.

Name Type Description
filePath

string

This path is invalid if 'Continuous Capture' is provided with 'true' or 'false'. A valid local path on the targeting VM. Must include the name of the capture file (*.cap). For linux virtual machine it must start with /var/captures. Required if no storage ID is provided, otherwise optional.

localPath

string

This path is valid if 'Continuous Capture' is provided with 'true' or 'false' and required if no storage ID is provided, otherwise optional. Must include the name of the capture file (*.cap). For linux virtual machine it must start with /var/captures.

storageId

string

The ID of the storage account to save the packet capture session. Required if no localPath or filePath is provided.

storagePath

string

The URI of the storage path to save the packet capture. Must be a well-formed URI describing the location to save the packet capture.

PacketCaptureTargetType

Target type of the resource provided.

Value Description
AzureVM
AzureVMSS

PcProtocol

Protocol to be filtered on.

Value Description
TCP
UDP
Any

ProvisioningState

The current provisioning state.

Value Description
Succeeded
Updating
Deleting
Failed