az monitor app-insights web-test
Note
This reference is part of the application-insights extension for the Azure CLI (version 2.71.0 or higher). 该扩展将在首次运行 az monitor app-insights web-test 命令时自动安装。 Learn more about extensions.
使用 Application Insights 管理 Web 测试。
命令
名称 | 说明 | 类型 | Status |
---|---|---|---|
az monitor app-insights web-test create |
创建 Application Insights Web 测试定义。 |
Extension | GA |
az monitor app-insights web-test delete |
删除 Application Insights Web 测试。 |
Extension | GA |
az monitor app-insights web-test list |
获取为指定组件定义的所有 Application Insights Web 测试。 获取在指定资源组中定义的所有 Application Insights Web 测试。 获取订阅中的所有 Application Insights Web 测试警报定义。 |
Extension | GA |
az monitor app-insights web-test show |
获取特定的 Application Insights Web 测试定义。 |
Extension | GA |
az monitor app-insights web-test update |
更新 Application Insights Web 测试定义。 |
Extension | GA |
az monitor app-insights web-test create
创建 Application Insights Web 测试定义。
az monitor app-insights web-test create --name --web-test-name
--resource-group
[--content-validation]
[--defined-web-test-name]
[--description]
[--enabled {false, true}]
[--expected-status-code]
[--follow-redirects {false, true}]
[--frequency]
[--headers]
[--http-verb]
[--ignore-status-code {false, true}]
[--kind {multistep, ping}]
[--location]
[--locations]
[--parse-requests {false, true}]
[--request-body]
[--request-url]
[--retry-enabled {false, true}]
[--ssl-check {false, true}]
[--ssl-lifetime-check]
[--synthetic-monitor-id]
[--tags]
[--timeout]
[--web-test]
[--web-test-kind {multistep, ping, standard}]
示例
webTestCreate
az monitor app-insights web-test create --kind "ping" --location "South Central US" --web-test "<WebTest Name=\"my-webtest\" Id=\"678ddf96-1ab8-44c8-9274-123456789abc\" Enabled=\"True\" CssProjectStructure=\"\" CssIteration=\"\" Timeout=\"120\" WorkItemIds=\"\" xmlns=\"http://microsoft.com/schemas/VisualStudio/TeamTest/2010\" Description=\"\" CredentialUserName=\"\" CredentialPassword=\"\" PreAuthenticate=\"True\" Proxy=\"default\" StopOnError=\"False\" RecordedResultFile=\"\" ResultsLocale=\"\" ><Items><Request Method=\"GET\" Guid=\"a4162485-9114-fcfc-e086-123456789abc\" Version=\"1.1\" Url=\"http://my-component.azurewebsites.net\" ThinkTime=\"0\" Timeout=\"120\" ParseDependentRequests=\"True\" FollowRedirects=\"True\" RecordResult=\"True\" Cache=\"False\" ResponseTimeGoal=\"0\" Encoding=\"utf-8\" ExpectedHttpStatusCode=\"200\" ExpectedResponseUrl=\"\" ReportingName=\"\" IgnoreHttpStatusCode=\"False\" /></Items></WebTest>" --description "Ping web test alert for mytestwebapp" --enabled true --frequency 900 --web-test-kind "ping" --locations Id="us-fl-mia-edge" --defined-web-test-name "my-webtest-my-component" --retry-enabled true --synthetic-monitor-id "my-webtest-my-component" --timeout 120 --resource-group "my-resource-group" --name "my-webtest-my-component" --tags hidden-link:XX=XX
webTestCreateStandard
az monitor app-insights web-test create --location "South Central US" --description "Ping web test alert for mytestwebapp" --enabled true --frequency 900 --web-test-kind "standard" --locations Id="us-fl-mia-edge" --defined-web-test-name "my-webtest-my-component" --http-verb "POST" --request-body "SGVsbG8gd29ybGQ=" --request-url "https://bing.com" --retry-enabled true --synthetic-monitor-id "my-webtest-my-component" --timeout 120 --ssl-lifetime-check 100 --ssl-check true --resource-group "my-resource-group" --name "my-webtest-my-component" --tags hidden-link:XX=XX
必需参数
Application Insights WebTest 资源的名称。
资源组的名称。 可以使用 az configure --defaults group=<name>
配置默认组。
可选参数
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
内容验证属性的集合。
用法:--content-validation content-match=XX ignore-case=XX pass-if-text-found=XX
content-match:在 WebTest 的返回中查找的内容。 不得为 null 或为空。 ignore-case:设置时,此值使 ContentMatch 验证大小写不区分大小写。 pass-if-text-found:如果为 true,则验证将传递,前提是 ContentMatch 字符串匹配。 如果为 false,则存在匹配项时验证将失败。
属性 | 值 |
---|---|
Parameter group: | Validation Rules Arguments |
如果用户定义的名称,则为此 WebTest。
此 WebTest 的用户定义说明。
正在主动监视测试。
属性 | 值 |
---|---|
接受的值: | false, true |
验证 WebTest 是否返回提供的 http 状态代码。
属性 | 值 |
---|---|
Parameter group: | Validation Rules Arguments |
按照此 Web 测试的重定向作。
属性 | 值 |
---|---|
Parameter group: | Request Arguments |
接受的值: | false, true |
此 WebTest 的测试运行间隔(以秒为单位)。 默认值为 300。
要添加到 WebTest 调用的标头及其值的列表。
用法:--headers key=XX value=XX
键:标头的名称。 value:标头的值。
可以使用多个 --headers 参数指定多个作。
属性 | 值 |
---|---|
Parameter group: | Request Arguments |
要用于此 Web 测试的 Http 谓词。
属性 | 值 |
---|---|
Parameter group: | Request Arguments |
设置后,验证将忽略状态代码。
属性 | 值 |
---|---|
Parameter group: | Validation Rules Arguments |
接受的值: | false, true |
此 Web 测试监视的 WebTest 类型。 选项为 ping 和 multistep。
属性 | 值 |
---|---|
接受的值: | multistep, ping |
Location.
az account list-locations
中的值。 可以使用 az configure --defaults location=<location>
配置默认位置。
一个列表,其中列出了从何处物理运行测试,以便为应用程序的可访问性提供全局覆盖范围。
用法:--locations Id=XX
ID:要从中运行的 WebTest 的位置 ID。
可以使用多个 --locations 参数指定多个作。
分析此 WebTest 的从属请求。
属性 | 值 |
---|---|
Parameter group: | Request Arguments |
接受的值: | false, true |
要随此 Web 测试一起发送的 Base64 编码字符串正文。
属性 | 值 |
---|---|
Parameter group: | Request Arguments |
要测试的 URL 位置。
属性 | 值 |
---|---|
Parameter group: | Request Arguments |
如果此 WebTest 失败,则允许重试。
属性 | 值 |
---|---|
接受的值: | false, true |
检查 SSL 证书是否仍然有效。
属性 | 值 |
---|---|
Parameter group: | Validation Rules Arguments |
接受的值: | false, true |
在现有 SSL 证书过期之前,仍要检查的天数。 值必须为正值,SSLCheck 必须设置为 true。
属性 | 值 |
---|---|
Parameter group: | Validation Rules Arguments |
此 WebTest 的唯一 ID。 此值通常与“名称”字段相同。
空格分隔标记:key[=value] [key[=value] ...]。使用“”清除现有标记。
直到此 WebTest 超时并失败的秒。 默认值为 30。
要针对应用程序运行的 WebTest 的 XML 规范。
属性 | 值 |
---|---|
Parameter group: | Configuration Arguments |
Web 测试的类型是 ping、多步骤和标准。
属性 | 值 |
---|---|
接受的值: | multistep, ping, standard |
全局参数
提高日志记录详细程度以显示所有调试日志。
属性 | 值 |
---|---|
默认值: | False |
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
属性 | 值 |
---|---|
默认值: | False |
Output format.
属性 | 值 |
---|---|
默认值: | json |
接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
属性 | 值 |
---|---|
默认值: | False |
az monitor app-insights web-test delete
删除 Application Insights Web 测试。
az monitor app-insights web-test delete --name --web-test-name
--resource-group
[--yes]
示例
webTestDelete
az monitor app-insights web-test delete --resource-group "my-resource-group" --name "my-webtest-01-mywebservice"
必需参数
Application Insights WebTest 资源的名称。
资源组的名称。 可以使用 az configure --defaults group=<name>
配置默认组。
可选参数
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
不要提示确认。
属性 | 值 |
---|---|
默认值: | False |
全局参数
提高日志记录详细程度以显示所有调试日志。
属性 | 值 |
---|---|
默认值: | False |
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
属性 | 值 |
---|---|
默认值: | False |
Output format.
属性 | 值 |
---|---|
默认值: | json |
接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
属性 | 值 |
---|---|
默认值: | False |
az monitor app-insights web-test list
获取为指定组件定义的所有 Application Insights Web 测试。 获取在指定资源组中定义的所有 Application Insights Web 测试。 获取订阅中的所有 Application Insights Web 测试警报定义。
az monitor app-insights web-test list [--component-name]
[--resource-group]
示例
webTestListByComponent
az monitor app-insights web-test list --component-name "my-component" --resource-group "my-resource-group"
webTestListByResourceGroup
az monitor app-insights web-test list --resource-group "my-resource-group"
webTestList
az monitor app-insights web-test list
可选参数
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
Application Insights 组件资源的名称。
资源组的名称。 可以使用 az configure --defaults group=<name>
配置默认组。
全局参数
提高日志记录详细程度以显示所有调试日志。
属性 | 值 |
---|---|
默认值: | False |
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
属性 | 值 |
---|---|
默认值: | False |
Output format.
属性 | 值 |
---|---|
默认值: | json |
接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
属性 | 值 |
---|---|
默认值: | False |
az monitor app-insights web-test show
获取特定的 Application Insights Web 测试定义。
az monitor app-insights web-test show --name --web-test-name
--resource-group
示例
webTestGet
az monitor app-insights web-test show --resource-group "my-resource-group" --name "my-webtest-01-mywebservice"
必需参数
Application Insights WebTest 资源的名称。
资源组的名称。 可以使用 az configure --defaults group=<name>
配置默认组。
全局参数
提高日志记录详细程度以显示所有调试日志。
属性 | 值 |
---|---|
默认值: | False |
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
属性 | 值 |
---|---|
默认值: | False |
Output format.
属性 | 值 |
---|---|
默认值: | json |
接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
属性 | 值 |
---|---|
默认值: | False |
az monitor app-insights web-test update
更新 Application Insights Web 测试定义。
az monitor app-insights web-test update --name --web-test-name
--resource-group
[--add]
[--content-validation]
[--defined-web-test-name]
[--description]
[--enabled {false, true}]
[--expected-status-code]
[--follow-redirects {false, true}]
[--force-string]
[--frequency]
[--headers]
[--http-verb]
[--ignore-status-code {false, true}]
[--kind {multistep, ping}]
[--location]
[--locations]
[--parse-requests {false, true}]
[--remove]
[--request-body]
[--request-url]
[--retry-enabled {false, true}]
[--set]
[--ssl-check {false, true}]
[--ssl-lifetime-check]
[--synthetic-monitor-id]
[--tags]
[--timeout]
[--web-test]
[--web-test-kind {multistep, ping, standard}]
示例
webTestUpdate
az monitor app-insights web-test update --kind "ping" --location "South Central US" --web-test "<WebTest Name=\"my-webtest\" Id=\"678ddf96-1ab8-44c8-9274-123456789abc\" Enabled=\"True\" CssProjectStructure=\"\" CssIteration=\"\" Timeout=\"30\" WorkItemIds=\"\" xmlns=\"http://microsoft.com/schemas/VisualStudio/TeamTest/2010\" Description=\"\" CredentialUserName=\"\" CredentialPassword=\"\" PreAuthenticate=\"True\" Proxy=\"default\" StopOnError=\"False\" RecordedResultFile=\"\" ResultsLocale=\"\" ><Items><Request Method=\"GET\" Guid=\"a4162485-9114-fcfc-e086-123456789abc\" Version=\"1.1\" Url=\"http://my-component.azurewebsites.net\" ThinkTime=\"0\" Timeout=\"30\" ParseDependentRequests=\"True\" FollowRedirects=\"True\" RecordResult=\"True\" Cache=\"False\" ResponseTimeGoal=\"0\" Encoding=\"utf-8\" ExpectedHttpStatusCode=\"200\" ExpectedResponseUrl=\"\" ReportingName=\"\" IgnoreHttpStatusCode=\"False\" /></Items></WebTest>" --frequency 600 --web-test-kind "ping" --locations Id="us-fl-mia-edge" --locations Id="apac-hk-hkn-azr" --defined-web-test-name "my-webtest-my-component" --synthetic-monitor-id "my-webtest-my-component" --timeout 30 --resource-group "my-resource-group" --name "my-webtest-my-component"
必需参数
Application Insights WebTest 资源的名称。
资源组的名称。 可以使用 az configure --defaults group=<name>
配置默认组。
可选参数
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
通过指定路径和键值对将对象添加到对象列表。 示例:--add property.listProperty <key=value, string or JSON string>
。
属性 | 值 |
---|---|
Parameter group: | Generic Update Arguments |
默认值: | [] |
内容验证属性的集合。
用法:--content-validation content-match=XX ignore-case=XX pass-if-text-found=XX
content-match:在 WebTest 的返回中查找的内容。 不得为 null 或为空。 ignore-case:设置时,此值使 ContentMatch 验证大小写不区分大小写。 pass-if-text-found:如果为 true,则验证将传递,前提是 ContentMatch 字符串匹配。 如果为 false,则存在匹配项时验证将失败。
属性 | 值 |
---|---|
Parameter group: | Validation Rules Arguments |
如果用户定义的名称,则为此 WebTest。
此 WebTest 的用户定义说明。
正在主动监视测试。
属性 | 值 |
---|---|
接受的值: | false, true |
验证 WebTest 是否返回提供的 http 状态代码。
属性 | 值 |
---|---|
Parameter group: | Validation Rules Arguments |
按照此 Web 测试的重定向作。
属性 | 值 |
---|---|
Parameter group: | Request Arguments |
接受的值: | false, true |
使用“set”或“add”时,保留字符串文本,而不是尝试转换为 JSON。
属性 | 值 |
---|---|
Parameter group: | Generic Update Arguments |
默认值: | False |
此 WebTest 的测试运行间隔(以秒为单位)。 默认值为 300。
要添加到 WebTest 调用的标头及其值的列表。
用法:--headers key=XX value=XX
键:标头的名称。 value:标头的值。
可以使用多个 --headers 参数指定多个作。
属性 | 值 |
---|---|
Parameter group: | Request Arguments |
要用于此 Web 测试的 Http 谓词。
属性 | 值 |
---|---|
Parameter group: | Request Arguments |
设置后,验证将忽略状态代码。
属性 | 值 |
---|---|
Parameter group: | Validation Rules Arguments |
接受的值: | false, true |
此 Web 测试监视的 WebTest 类型。 选项为 ping 和 multistep。
属性 | 值 |
---|---|
接受的值: | multistep, ping |
Location.
az account list-locations
中的值。 可以使用 az configure --defaults location=<location>
配置默认位置。
一个列表,其中列出了从何处物理运行测试,以便为应用程序的可访问性提供全局覆盖范围。
用法:--locations Id=XX
ID:要从中运行的 WebTest 的位置 ID。
可以使用多个 --locations 参数指定多个作。
分析此 WebTest 的从属请求。
属性 | 值 |
---|---|
Parameter group: | Request Arguments |
接受的值: | false, true |
从列表中删除属性或元素。 示例: --remove property.list <indexToRemove>
OR --remove propertyToRemove
.
属性 | 值 |
---|---|
Parameter group: | Generic Update Arguments |
默认值: | [] |
要随此 Web 测试一起发送的 Base64 编码字符串正文。
属性 | 值 |
---|---|
Parameter group: | Request Arguments |
要测试的 URL 位置。
属性 | 值 |
---|---|
Parameter group: | Request Arguments |
如果此 WebTest 失败,则允许重试。
属性 | 值 |
---|---|
接受的值: | false, true |
通过指定要设置的属性路径和值来更新对象。 示例:--set property1.property2=<value>
。
属性 | 值 |
---|---|
Parameter group: | Generic Update Arguments |
默认值: | [] |
检查 SSL 证书是否仍然有效。
属性 | 值 |
---|---|
Parameter group: | Validation Rules Arguments |
接受的值: | false, true |
在现有 SSL 证书过期之前,仍要检查的天数。 值必须为正值,SSLCheck 必须设置为 true。
属性 | 值 |
---|---|
Parameter group: | Validation Rules Arguments |
此 WebTest 的唯一 ID。 此值通常与“名称”字段相同。
空格分隔标记:key[=value] [key[=value] ...]。使用“”清除现有标记。
直到此 WebTest 超时并失败的秒。 默认值为 30。
要针对应用程序运行的 WebTest 的 XML 规范。
属性 | 值 |
---|---|
Parameter group: | Configuration Arguments |
Web 测试的类型是 ping、多步骤和标准。
属性 | 值 |
---|---|
接受的值: | multistep, ping, standard |
全局参数
提高日志记录详细程度以显示所有调试日志。
属性 | 值 |
---|---|
默认值: | False |
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
属性 | 值 |
---|---|
默认值: | False |
Output format.
属性 | 值 |
---|---|
默认值: | json |
接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
属性 | 值 |
---|---|
默认值: | False |