你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Packet Captures - Create
在指定的 VM 上创建并启动数据包捕获。
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}?api-version=2023-09-01
URI 参数
名称 | 在 | 必需 | 类型 | 说明 |
---|---|---|---|---|
network
|
path | True |
string |
网络观察程序的名称。 |
packet
|
path | True |
string |
数据包捕获会话的名称。 |
resource
|
path | True |
string |
资源组的名称。 |
subscription
|
path | True |
string |
可以唯一标识 Microsoft Azure 订阅的订阅凭据。 此订阅 ID 是每个服务调用的 URI 的一部分。 |
api-version
|
query | True |
string |
客户端 API 版本。 |
请求正文
名称 | 必需 | 类型 | 说明 |
---|---|---|---|
properties.storageLocation | True |
数据包捕获会话的存储位置。 |
|
properties.target | True |
string |
当前仅支持将 AzureVM 和 AzureVMSS 作为目标类型的目标资源的 ID。 |
properties.bytesToCapturePerPacket |
integer |
每个数据包捕获的字节数,其余字节将被截断。 |
|
properties.filters |
数据包捕获筛选器的列表。 |
||
properties.scope |
可以包含或排除以运行数据包捕获的 AzureVMSS 实例的列表。 如果包含和排除的都是空的,则数据包捕获将在 AzureVMSS 的所有实例上运行。 |
||
properties.targetType |
提供的资源的目标类型。 |
||
properties.timeLimitInSeconds |
integer |
捕获会话的最大持续时间(以秒为单位)。 |
|
properties.totalBytesPerSession |
integer |
捕获输出的最大大小。 |
响应
名称 | 类型 | 说明 |
---|---|---|
201 Created |
请求成功。 该操作返回生成的数据包捕获会话。 |
|
Other Status Codes |
描述操作失败原因的错误响应。 |
安全性
azure_auth
Azure Active Directory OAuth2 Flow。
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
名称 | 说明 |
---|---|
user_impersonation | 模拟用户帐户 |
示例
Create packet capture
Sample Request
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkWatchers/nw1/packetCaptures/pc1?api-version=2023-09-01
{
"properties": {
"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"
}
]
}
}
Sample Response
{
"name": "pc1",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkWatchers/nw1/packetCaptures/pc1",
"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"
}
]
}
}
定义
名称 | 说明 |
---|---|
Error |
常见错误详细信息表示形式。 |
Error |
错误对象。 |
Packet |
定义创建数据包捕获操作的参数。 |
Packet |
应用于数据包捕获请求的筛选器。 可以应用多个筛选器。 |
Packet |
可以包含或排除以运行数据包捕获的 AzureVMSS 实例的列表。 如果包含和排除的都是空的,则数据包捕获将在 AzureVMSS 的所有实例上运行。 |
Packet |
有关数据包捕获会话的信息。 |
Packet |
数据包捕获会话的存储位置。 |
Packet |
提供的资源的目标类型。 |
Pc |
要筛选的协议。 |
Provisioning |
当前预配状态。 |
ErrorDetails
常见错误详细信息表示形式。
名称 | 类型 | 说明 |
---|---|---|
code |
string |
错误代码。 |
message |
string |
错误消息。 |
target |
string |
错误目标。 |
ErrorResponse
错误对象。
名称 | 类型 | 说明 |
---|---|---|
error |
错误 |
PacketCapture
定义创建数据包捕获操作的参数。
名称 | 类型 | 默认值 | 说明 |
---|---|---|---|
properties.bytesToCapturePerPacket |
integer |
0 |
每个数据包捕获的字节数,其余字节将被截断。 |
properties.filters |
数据包捕获筛选器的列表。 |
||
properties.scope |
可以包含或排除以运行数据包捕获的 AzureVMSS 实例的列表。 如果包含和排除的都是空的,则数据包捕获将在 AzureVMSS 的所有实例上运行。 |
||
properties.storageLocation |
数据包捕获会话的存储位置。 |
||
properties.target |
string |
当前仅支持将 AzureVM 和 AzureVMSS 作为目标类型的目标资源的 ID。 |
|
properties.targetType |
提供的资源的目标类型。 |
||
properties.timeLimitInSeconds |
integer |
18000 |
捕获会话的最大持续时间(以秒为单位)。 |
properties.totalBytesPerSession |
integer |
1073741824 |
捕获输出的最大大小。 |
PacketCaptureFilter
应用于数据包捕获请求的筛选器。 可以应用多个筛选器。
名称 | 类型 | 默认值 | 说明 |
---|---|---|---|
localIPAddress |
string |
要筛选的本地 IP 地址。 表示法:单个地址条目的“127.0.0.1”。 范围为“127.0.0.1-127.0.0.255”。 "127.0.0.1;127.0.0.5"? 用于多个条目。 当前不支持多个范围。 当前不支持混合具有多个条目的范围。 默认值 = null。 |
|
localPort |
string |
要筛选的本地端口。 表示法:“80”表示单个端口输入。”范围为 80-85 英寸。 "80;443;“,用于多个条目。 当前不支持多个范围。 当前不支持混合具有多个条目的范围。 默认值 = null。 |
|
protocol | Any |
要筛选的协议。 |
|
remoteIPAddress |
string |
要筛选的本地 IP 地址。 表示法:单个地址条目的“127.0.0.1”。 范围为“127.0.0.1-127.0.0.255”。 "127.0.0.1;127.0.0.5;“对于多个条目。 当前不支持多个范围。 当前不支持混合具有多个条目的范围。 默认值 = null。 |
|
remotePort |
string |
要筛选的远程端口。 表示法:“80”表示单个端口输入。”范围为 80-85 英寸。 "80;443;“,用于多个条目。 当前不支持多个范围。 当前不支持混合具有多个条目的范围。 默认值 = null。 |
PacketCaptureMachineScope
可以包含或排除以运行数据包捕获的 AzureVMSS 实例的列表。 如果包含和排除的都是空的,则数据包捕获将在 AzureVMSS 的所有实例上运行。
名称 | 类型 | 说明 |
---|---|---|
exclude |
string[] |
必须从 AzureVMSS 中排除运行数据包捕获的 AzureVMSS 实例的列表。 |
include |
string[] |
要运行数据包捕获的 AzureVMSS 实例的列表。 |
PacketCaptureResult
有关数据包捕获会话的信息。
名称 | 类型 | 默认值 | 说明 |
---|---|---|---|
etag |
string |
一个唯一的只读字符串,每当资源更新时都会更改。 |
|
id |
string |
数据包捕获操作的 ID。 |
|
name |
string |
数据包捕获会话的名称。 |
|
properties.bytesToCapturePerPacket |
integer |
0 |
每个数据包捕获的字节数,其余字节将被截断。 |
properties.filters |
数据包捕获筛选器的列表。 |
||
properties.provisioningState |
数据包捕获会话的预配状态。 |
||
properties.scope |
可以包含或排除以运行数据包捕获的 AzureVMSS 实例的列表。 如果包含和排除的都是空的,则数据包捕获将在 AzureVMSS 的所有实例上运行。 |
||
properties.storageLocation |
数据包捕获会话的存储位置。 |
||
properties.target |
string |
当前仅支持将 AzureVM 和 AzureVMSS 作为目标类型的目标资源的 ID。 |
|
properties.targetType |
提供的资源的目标类型。 |
||
properties.timeLimitInSeconds |
integer |
18000 |
捕获会话的最大持续时间(以秒为单位)。 |
properties.totalBytesPerSession |
integer |
1073741824 |
捕获输出的最大大小。 |
PacketCaptureStorageLocation
数据包捕获会话的存储位置。
名称 | 类型 | 说明 |
---|---|---|
filePath |
string |
目标 VM 上的有效本地路径。 必须包含捕获文件的名称 (*.cap) 。 对于 Linux 虚拟机,它必须以 /var/captures 开头。 如果未提供存储 ID,则为必需;否则为可选。 |
storageId |
string |
用于保存数据包捕获会话的存储帐户的 ID。 如果未提供本地文件路径,则为必需。 |
storagePath |
string |
用于保存数据包捕获的存储路径的 URI。 必须是格式正确的 URI,用于描述保存数据包捕获的位置。 |
PacketCaptureTargetType
提供的资源的目标类型。
名称 | 类型 | 说明 |
---|---|---|
AzureVM |
string |
|
AzureVMSS |
string |
PcProtocol
要筛选的协议。
名称 | 类型 | 说明 |
---|---|---|
Any |
string |
|
TCP |
string |
|
UDP |
string |
ProvisioningState
当前预配状态。
名称 | 类型 | 说明 |
---|---|---|
Deleting |
string |
|
Failed |
string |
|
Succeeded |
string |
|
Updating |
string |