az network watcher packet-capture
管理 VM 上的数据包捕获会话。
这些命令要求为 VM 区域启用 Azure 网络观察程序,并在 VM 上启用 AzureNetworkWatcherExtension。 有关详细信息,请访问 https://free.blessedness.top/en-us/azure/network-watcher/network-watcher-packet-capture-manage-cli。
命令
| 名称 | 说明 | 类型 | Status |
|---|---|---|---|
| az network watcher packet-capture create |
创建并启动数据包捕获会话。 |
Core | GA |
| az network watcher packet-capture delete |
删除数据包捕获会话。 |
Core | GA |
| az network watcher packet-capture list |
列出区域中的所有数据包捕获会话。 |
Core | GA |
| az network watcher packet-capture show |
显示数据包捕获会话的详细信息。 |
Core | GA |
| az network watcher packet-capture show-status |
显示数据包捕获会话的状态。 |
Core | GA |
| az network watcher packet-capture stop |
停止正在运行的数据包捕获会话。 |
Core | GA |
| az network watcher packet-capture wait |
将 CLI 置于等待状态,直到满足条件。 |
Core | GA |
az network watcher packet-capture create
创建并启动数据包捕获会话。
az network watcher packet-capture create --name
--resource-group
[--capture-limit]
[--capture-size]
[--exclude]
[--file-path]
[--filters]
[--include]
[--no-wait {0, 1, f, false, n, no, t, true, y, yes}]
[--storage-account]
[--storage-path]
[--target]
[--target-type {AzureVM, AzureVMSS}]
[--time-limit]
[--vm]
示例
在 VM 上创建数据包捕获会话。
az network watcher packet-capture create -g MyResourceGroup -n MyPacketCaptureName --vm MyVm --storage-account MyStorageAccount
在 VM 上创建数据包捕获会话,其中包含协议、本地 IP 地址和远程 IP 地址范围和端口的可选筛选器。
az network watcher packet-capture create -g MyResourceGroup -n MyPacketCaptureName --vm MyVm --storage-account MyStorageAccount --filters '[{"protocol":"TCP", "remoteIPAddress":"1.1.1.1-255.255.255", "localIPAddress":"10.0.0.3", "remotePort":"20"}, {"protocol":"TCP", "remoteIPAddress":"1.1.1.1-255.255.255", "localIPAddress":"10.0.0.3", "remotePort":"80"}, {"protocol":"TCP", "remoteIPAddress":"1.1.1.1-255.255.255", "localIPAddress":"10.0.0.3", "remotePort":"443"}, {"protocol":"UDP"}]'
在 VMSS 上创建数据包捕获会话。
az network watcher packet-capture create -g MyResourceGroup -n MyPacketCaptureName --vm MyVmVMSS --storage-account MyStorageAccount --target-type "AzureVMSS"
在包含特定实例的 VMSS 上创建数据包捕获会话。
az network watcher packet-capture create -g MyResourceGroup -n MyPacketCaptureName --target MyVmVMSS --storage-account MyStorageAccount --target-type "AzureVMSS" --include "0" "1"
在包含排除特定实例的 VMSS 上创建数据包捕获会话。
az network watcher packet-capture create -g MyResourceGroup -n MyPacketCaptureName --vm MyVmVMSS --storage-account MyStorageAccount --target-type "AzureVMSS" --exclude "0" "1"
必需参数
数据包捕获会话的名称。
目标资源位于的资源组的名称。
可选参数
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
捕获输出的最大大小(以字节为单位)。
| 属性 | 值 |
|---|---|
| 默认值: | 1073741824 |
每个数据包捕获的字节数。 将截断多余的字节。
| 属性 | 值 |
|---|---|
| 默认值: | 0 |
在数据包捕获中要排除的 VMSS 实例的空间分隔列表。 支持速记语法、json-file 和 yaml-file。 请尝试“??” 以显示更多内容。
| 属性 | 值 |
|---|---|
| Parameter group: | Scope Arguments |
要在其中保存数据包捕获的目标 VM 上的本地路径。 对于 Linux VM,路径必须以 /var/captures开头。
| 属性 | 值 |
|---|---|
| Parameter group: | Storage Arguments |
数据包筛选器的 JSON 编码列表。 使用 @{path} 从文件加载。 支持速记语法、json-file 和 yaml-file。 请尝试“??” 以显示更多内容。
要包括在数据包捕获中的 VMSS 实例的空间分隔列表,例如 0 1 2。 支持速记语法、json-file 和 yaml-file。 请尝试“??” 以显示更多内容。
| 属性 | 值 |
|---|---|
| Parameter group: | Scope Arguments |
不等待长时间运行的操作完成。
| 属性 | 值 |
|---|---|
| 接受的值: | 0, 1, f, false, n, no, t, true, y, yes |
存储帐户的名称或 ID,用于将数据包捕获保存到其中。
| 属性 | 值 |
|---|---|
| Parameter group: | Storage Arguments |
要在其中存储捕获文件的现有存储容器的完全限定 URI。 如果未指定,则创建容器 network-watcher-logs(如果该容器不存在),并且捕获文件将存储在该位置。
| 属性 | 值 |
|---|---|
| Parameter group: | Storage Arguments |
目标资源的名称或 ID。 如果 --target-type 为 AzureVMSS,则必须 --target。
目标的资源类型。
| 属性 | 值 |
|---|---|
| 默认值: | AzureVM |
| 接受的值: | AzureVM, AzureVMSS |
捕获会话的最大持续时间(以秒为单位)。
| 属性 | 值 |
|---|---|
| 默认值: | 18000 |
要面向的 VM 的名称或 ID。
全局参数
提高日志记录详细程度以显示所有调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
| 属性 | 值 |
|---|---|
| 默认值: | False |
输出格式。
| 属性 | 值 |
|---|---|
| 默认值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |
az network watcher packet-capture delete
删除数据包捕获会话。
az network watcher packet-capture delete --location
--name
[--no-wait {0, 1, f, false, n, no, t, true, y, yes}]
示例
删除数据包捕获会话。 这只会删除会话,而不是捕获文件。
az network watcher packet-capture delete -n packetCaptureName -l westcentralus
必需参数
Location.
az account list-locations 中的值。 可以使用 az configure --defaults location=<location> 配置默认位置。
数据包捕获会话的名称。
可选参数
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
不等待长时间运行的操作完成。
| 属性 | 值 |
|---|---|
| 接受的值: | 0, 1, f, false, n, no, t, true, y, yes |
全局参数
提高日志记录详细程度以显示所有调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
| 属性 | 值 |
|---|---|
| 默认值: | False |
输出格式。
| 属性 | 值 |
|---|---|
| 默认值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |
az network watcher packet-capture list
列出区域中的所有数据包捕获会话。
az network watcher packet-capture list --location
示例
列出区域中的所有数据包捕获会话。
az az network watcher packet-capture list -l westus
必需参数
Location.
az account list-locations 中的值。 可以使用 az configure --defaults location=<location> 配置默认位置。
全局参数
提高日志记录详细程度以显示所有调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
| 属性 | 值 |
|---|---|
| 默认值: | False |
输出格式。
| 属性 | 值 |
|---|---|
| 默认值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |
az network watcher packet-capture show
显示数据包捕获会话的详细信息。
az network watcher packet-capture show --location
--name
示例
显示数据包捕获会话。
az network watcher packet-capture show -l westus -n MyPacketCapture
必需参数
Location.
az account list-locations 中的值。 可以使用 az configure --defaults location=<location> 配置默认位置。
数据包捕获会话的名称。
全局参数
提高日志记录详细程度以显示所有调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
| 属性 | 值 |
|---|---|
| 默认值: | False |
输出格式。
| 属性 | 值 |
|---|---|
| 默认值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |
az network watcher packet-capture show-status
显示数据包捕获会话的状态。
az network watcher packet-capture show-status --location
--name
[--no-wait {0, 1, f, false, n, no, t, true, y, yes}]
示例
显示数据包捕获会话的状态。
az network watcher packet-capture show-status -l westus -n MyPacketCapture
必需参数
Location.
az account list-locations 中的值。 可以使用 az configure --defaults location=<location> 配置默认位置。
为数据包捕获会话指定的名称。
可选参数
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
不等待长时间运行的操作完成。
| 属性 | 值 |
|---|---|
| 接受的值: | 0, 1, f, false, n, no, t, true, y, yes |
全局参数
提高日志记录详细程度以显示所有调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
| 属性 | 值 |
|---|---|
| 默认值: | False |
输出格式。
| 属性 | 值 |
|---|---|
| 默认值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |
az network watcher packet-capture stop
停止正在运行的数据包捕获会话。
az network watcher packet-capture stop --location
--name
[--no-wait {0, 1, f, false, n, no, t, true, y, yes}]
示例
停止正在运行的数据包捕获会话。
az network watcher packet-capture stop -l westus -n MyPacketCapture
必需参数
Location.
az account list-locations 中的值。 可以使用 az configure --defaults location=<location> 配置默认位置。
数据包捕获会话的名称。
可选参数
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
不等待长时间运行的操作完成。
| 属性 | 值 |
|---|---|
| 接受的值: | 0, 1, f, false, n, no, t, true, y, yes |
全局参数
提高日志记录详细程度以显示所有调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
| 属性 | 值 |
|---|---|
| 默认值: | False |
输出格式。
| 属性 | 值 |
|---|---|
| 默认值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |
az network watcher packet-capture wait
将 CLI 置于等待状态,直到满足条件。
az network watcher packet-capture wait [--created]
[--custom]
[--deleted]
[--exists]
[--ids]
[--interval]
[--name]
[--subscription]
[--timeout]
[--updated]
[--watcher-name]
[--watcher-rg]
可选参数
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
等待在“Succeeded”中使用“provisioningState”创建。
| 属性 | 值 |
|---|---|
| Parameter group: | Wait Condition Arguments |
| 默认值: | False |
等待条件满足自定义 JMESPath 查询。 例如 provisioningState!='InProgress', instanceView.statuses[?code=='PowerState/running']。
| 属性 | 值 |
|---|---|
| Parameter group: | Wait Condition Arguments |
等到删除为止。
| 属性 | 值 |
|---|---|
| Parameter group: | Wait Condition Arguments |
| 默认值: | False |
等待资源存在。
| 属性 | 值 |
|---|---|
| Parameter group: | Wait Condition Arguments |
| 默认值: | False |
一个或多个资源 ID(以空格分隔)。 它应该是包含“Resource Id”参数的所有信息的完整资源 ID。 应提供 --ids 或其他“Resource Id”参数。
| 属性 | 值 |
|---|---|
| Parameter group: | Resource Id Arguments |
轮询间隔(以秒为单位)。
| 属性 | 值 |
|---|---|
| Parameter group: | Wait Condition Arguments |
| 默认值: | 30 |
数据包捕获会话的名称。
| 属性 | 值 |
|---|---|
| Parameter group: | Resource Id Arguments |
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。
| 属性 | 值 |
|---|---|
| Parameter group: | Resource Id Arguments |
最大等待(以秒为单位)。
| 属性 | 值 |
|---|---|
| Parameter group: | Wait Condition Arguments |
| 默认值: | 3600 |
等到 provisioningState 更新为“Succeeded”。
| 属性 | 值 |
|---|---|
| Parameter group: | Wait Condition Arguments |
| 默认值: | False |
网络观察程序的名称。
| 属性 | 值 |
|---|---|
| Parameter group: | Resource Id Arguments |
观察程序在其中的资源组的名称。
| 属性 | 值 |
|---|---|
| Parameter group: | Resource Id Arguments |
全局参数
提高日志记录详细程度以显示所有调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
| 属性 | 值 |
|---|---|
| 默认值: | False |
输出格式。
| 属性 | 值 |
|---|---|
| 默认值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |