你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

az network network-watcher packet-capture

这些命令要求为 VM 区域启用 Azure 网络观察程序,并在 VM 上启用 AzureNetworkWatcherExtension。

命令

名称 说明 类型 Status
az network network-watcher packet-capture create

在指定的 VM 上创建并启动数据包捕获。

Core GA
az network network-watcher packet-capture delete

删除指定的数据包捕获会话。

Core GA
az network network-watcher packet-capture list

列出指定资源组中的所有数据包捕获会话。

Core GA
az network network-watcher packet-capture query-status

查询正在运行的数据包捕获会话的状态。

Core GA
az network network-watcher packet-capture show

按名称获取数据包捕获会话。

Core GA
az network network-watcher packet-capture stop

停止指定的数据包捕获会话。

Core GA

az network network-watcher packet-capture create

在指定的 VM 上创建并启动数据包捕获。

az network network-watcher packet-capture create --name --packet-capture-name
                                                 --network-watcher-name
                                                 --resource-group
                                                 --storage-location
                                                 --target
                                                 [--bytes-to-capture --bytes-to-capture-per-packet]
                                                 [--capture-settings]
                                                 [--continuous-capture {0, 1, f, false, n, no, t, true, y, yes}]
                                                 [--filters]
                                                 [--no-wait {0, 1, f, false, n, no, t, true, y, yes}]
                                                 [--scope]
                                                 [--target-type {AzureVM, AzureVMSS}]
                                                 [--time-limit-in-seconds]
                                                 [--total-bytes --total-bytes-per-session]

示例

创建和启动数据包捕获

az network network-watcher packet-capture create --network-watcher-name "NetworkWatcher_eastus2euap" --packet-capture-name "clitestpcap" --resource-group "NetworkWatcherRG" --storage-location '{"storageId": "/subscriptions//resourceGroups//providers/Microsoft.Storage/storageAccounts/", "filePath": "C:\Captures estByCli.cap"}' --target "/subscriptions/*****/resourceGroups//providers/Microsoft.Compute/virtualMachines/testVmName"

必需参数

--name --packet-capture-name -n

数据包捕获会话的名称。

--network-watcher-name

网络观察程序的名称。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name>配置默认组。

--storage-location

数据包捕获会话的存储位置。 支持速记语法、json-file 和 yaml-file。 请尝试“??” 以显示更多内容。

属性
参数组: Properties Arguments
--target

当前支持目标资源的 ID,仅支持作为目标类型的 AzureVM 和 AzureVMSS。

属性
参数组: Properties Arguments

可选参数

以下参数是可选的,但根据上下文,命令可能需要一个或多个参数才能成功执行。

--bytes-to-capture --bytes-to-capture-per-packet

每个数据包捕获的字节数,其余字节将被截断。

属性
参数组: Properties Arguments
默认值: 0
--capture-settings

捕获设置保存“FileCount”、“FileSizeInBytes”、“SessionTimeLimitInSeconds”值。 支持速记语法、json-file 和 yaml-file。 请尝试“??” 以显示更多内容。

属性
参数组: Properties Arguments
--continuous-capture

此连续捕获是可为 null 的布尔值,可以保存“null”、“true”或“false”值。 如果不传递此参数,则将其视为“null”,默认值为“null”。

属性
参数组: Properties Arguments
接受的值: 0, 1, f, false, n, no, t, true, y, yes
--filters

数据包捕获筛选器的列表。 支持速记语法、json-file 和 yaml-file。 请尝试“??” 以显示更多内容。

属性
参数组: Properties Arguments
--no-wait

不等待长时间运行的操作完成。

属性
接受的值: 0, 1, f, false, n, no, t, true, y, yes
--scope

可以包含或排除用于运行数据包捕获的 AzureVMSS 实例的列表。 如果包含和排除的都是空的,则数据包捕获将在 AzureVMSS 的所有实例上运行。 支持速记语法、json-file 和 yaml-file。 请尝试“??” 以显示更多内容。

属性
参数组: Properties Arguments
--target-type

提供的资源的目标类型。

属性
参数组: Properties Arguments
接受的值: AzureVM, AzureVMSS
--time-limit-in-seconds

捕获会话的最大持续时间(以秒为单位)。

属性
参数组: Properties Arguments
--total-bytes --total-bytes-per-session

捕获输出的最大大小。

属性
参数组: Properties Arguments
全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

属性
默认值: False
--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

属性
默认值: False
--output -o

输出格式。

属性
默认值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

增加日志记录详细程度。 使用 --debug 获取完整的调试日志。

属性
默认值: False

az network network-watcher packet-capture delete

删除指定的数据包捕获会话。

az network network-watcher packet-capture delete [--ids]
                                                 [--name --packet-capture-name]
                                                 [--network-watcher-name]
                                                 [--no-wait {0, 1, f, false, n, no, t, true, y, yes}]
                                                 [--resource-group]
                                                 [--subscription]
                                                 [--yes]

可选参数

以下参数是可选的,但根据上下文,命令可能需要一个或多个参数才能成功执行。

--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“Resource Id”参数的所有信息的完整资源 ID。 应提供 --ids 或其他“Resource Id”参数。

属性
参数组: Resource Id Arguments
--name --packet-capture-name -n

数据包捕获会话的名称。

属性
参数组: Resource Id Arguments
--network-watcher-name

网络观察程序的名称。

属性
参数组: Resource Id Arguments
--no-wait

不等待长时间运行的操作完成。

属性
接受的值: 0, 1, f, false, n, no, t, true, y, yes
--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name>配置默认组。

属性
参数组: Resource Id Arguments
--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

属性
参数组: Resource Id Arguments
--yes -y

不要提示确认。

属性
默认值: False
全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

属性
默认值: False
--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

属性
默认值: False
--output -o

输出格式。

属性
默认值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--verbose

增加日志记录详细程度。 使用 --debug 获取完整的调试日志。

属性
默认值: False

az network network-watcher packet-capture list

列出指定资源组中的所有数据包捕获会话。

az network network-watcher packet-capture list --network-watcher-name
                                               --resource-group

必需参数

--network-watcher-name

网络观察程序资源的名称。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name>配置默认组。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

属性
默认值: False
--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

属性
默认值: False
--output -o

输出格式。

属性
默认值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

增加日志记录详细程度。 使用 --debug 获取完整的调试日志。

属性
默认值: False

az network network-watcher packet-capture query-status

查询正在运行的数据包捕获会话的状态。

az network network-watcher packet-capture query-status [--ids]
                                                       [--network-watcher-name]
                                                       [--no-wait {0, 1, f, false, n, no, t, true, y, yes}]
                                                       [--packet-capture-name]
                                                       [--resource-group]
                                                       [--subscription]

示例

查询数据包捕获的状态

az network network-watcher packet-capture query-status --network-watcher-name "NetworkWatcher_eastus2euap" --packet-capture-name "clitestpacp3" --resource-group "NetworkWatcherRG"

可选参数

以下参数是可选的,但根据上下文,命令可能需要一个或多个参数才能成功执行。

--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“Resource Id”参数的所有信息的完整资源 ID。 应提供 --ids 或其他“Resource Id”参数。

属性
参数组: Resource Id Arguments
--network-watcher-name

网络观察程序资源的名称。

属性
参数组: Resource Id Arguments
--no-wait

不等待长时间运行的操作完成。

属性
接受的值: 0, 1, f, false, n, no, t, true, y, yes
--packet-capture-name

为数据包捕获会话提供的名称。

属性
参数组: Resource Id Arguments
--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name>配置默认组。

属性
参数组: Resource Id Arguments
--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

属性
参数组: Resource Id Arguments
全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

属性
默认值: False
--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

属性
默认值: False
--output -o

输出格式。

属性
默认值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--verbose

增加日志记录详细程度。 使用 --debug 获取完整的调试日志。

属性
默认值: False

az network network-watcher packet-capture show

按名称获取数据包捕获会话。

az network network-watcher packet-capture show [--ids]
                                               [--name --packet-capture-name]
                                               [--network-watcher-name]
                                               [--resource-group]
                                               [--subscription]

可选参数

以下参数是可选的,但根据上下文,命令可能需要一个或多个参数才能成功执行。

--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“Resource Id”参数的所有信息的完整资源 ID。 应提供 --ids 或其他“Resource Id”参数。

属性
参数组: Resource Id Arguments
--name --packet-capture-name -n

数据包捕获会话的名称。

属性
参数组: Resource Id Arguments
--network-watcher-name

网络观察程序的名称。

属性
参数组: Resource Id Arguments
--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name>配置默认组。

属性
参数组: Resource Id Arguments
--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

属性
参数组: Resource Id Arguments
全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

属性
默认值: False
--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

属性
默认值: False
--output -o

输出格式。

属性
默认值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--verbose

增加日志记录详细程度。 使用 --debug 获取完整的调试日志。

属性
默认值: False

az network network-watcher packet-capture stop

停止指定的数据包捕获会话。

az network network-watcher packet-capture stop [--ids]
                                               [--network-watcher-name]
                                               [--no-wait {0, 1, f, false, n, no, t, true, y, yes}]
                                               [--packet-capture-name]
                                               [--resource-group]
                                               [--subscription]

示例

停止数据包捕获

az network network-watcher packet-capture stop --network-watcher-name "NetworkWatcher_eastus2euap" --packet-capture-name "clitestpacp3" --resource-group "NetworkWatcherRG"

可选参数

以下参数是可选的,但根据上下文,命令可能需要一个或多个参数才能成功执行。

--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“Resource Id”参数的所有信息的完整资源 ID。 应提供 --ids 或其他“Resource Id”参数。

属性
参数组: Resource Id Arguments
--network-watcher-name

网络观察程序的名称。

属性
参数组: Resource Id Arguments
--no-wait

不等待长时间运行的操作完成。

属性
接受的值: 0, 1, f, false, n, no, t, true, y, yes
--packet-capture-name

数据包捕获会话的名称。

属性
参数组: Resource Id Arguments
--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name>配置默认组。

属性
参数组: Resource Id Arguments
--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

属性
参数组: Resource Id Arguments
全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

属性
默认值: False
--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

属性
默认值: False
--output -o

输出格式。

属性
默认值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--verbose

增加日志记录详细程度。 使用 --debug 获取完整的调试日志。

属性
默认值: False