az monitor app-insights web-test

注意

此參考是 Azure CLI 應用程式深入解析延伸模組的一部分(2.55.0 版或更高版本)。 擴充功能會在您第一次執行 az monitor app-insights web-test 命令時自動安裝。 深入了解擴充功能。

使用 Application Insights 管理 Web 測試。

命令

名稱 Description 類型 狀態
az monitor app-insights web-test create

建立 Application Insights Web 測試定義。

副檔名 GA
az monitor app-insights web-test delete

刪除 Application Insights Web 測試。

副檔名 GA
az monitor app-insights web-test list

取得針對指定元件定義的所有 Application Insights Web 測試。 以及取得指定資源群組內定義的所有 Application Insights Web 測試。 以及取得訂用帳戶內的所有ApplicationInsights Web測試警示定義。

副檔名 GA
az monitor app-insights web-test show

取得特定的 Application Insights Web 測試定義。

副檔名 GA
az monitor app-insights web-test update

更新 Application Insights Web 測試定義。

副檔名 GA

az monitor app-insights web-test create

建立 Application Insights Web 測試定義。

az monitor app-insights web-test create --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

必要參數

--name --web-test-name -n

Application Insights WebTest 資源的名稱。

--resource-group -g

資源群組的名稱。 您可以使用 來設定預設群組 az configure --defaults group=<name>

選擇性參數

--content-validation

內容驗證屬性的集合。

使用方式:--content-validation content-match=XX ignore-case=XX pass-if-text-found=XX

content-match:在 WebTest 傳回中尋找的內容。 不得為 Null 或空白。 ignore-case:設定時,此值會使 ContentMatch 驗證案例不區分。 pass-if-text-found:如果 ContentMatch 字串相符,驗證將會通過。 如果為 false,如果相符,驗證將會失敗。

--defined-web-test-name

如果這個 WebTest,則為使用者定義的名稱。

--description

此 WebTest 的使用者定義描述。

--enabled

是否正在主動監視測試。

接受的值: false, true
--expected-status-code

驗證 WebTest 是否傳回提供的 HTTP 狀態代碼。

--follow-redirects

請遵循此 Web 測試的重新導向。

接受的值: false, true
--frequency

此 WebTest 的測試回合之間以秒為單位的間隔。 預設值為 300。

--headers

要新增至 WebTest 呼叫的標頭及其值清單。

使用方式:--headers key=XX value=XX

機碼:標頭的名稱。 value:標頭的值。

您可以使用多個 --headers 自變數來指定多個動作。

--http-verb

要用於此 Web 測試的 Http 動詞。

--ignore-status-code

設定時,驗證會忽略狀態代碼。

接受的值: false, true
--kind

此 Web 測試所監看的 WebTest 種類。 選項為 ping 和 multistep。

接受的值: multistep, ping
--location -l

位置。​​ 來自的值: az account list-locations。 您可以使用 az configure --defaults location=<location> 設定預設位置。

--locations

實際執行測試的來源清單,以提供應用程式輔助功能的全域涵蓋範圍。

使用量:--locations Id=XX

標識碼:要從中執行之 WebTest 的位置識別碼。

您可以使用多個 --locations 自變數來指定多個動作。

--parse-requests

剖析此 WebTest 的相依要求。

接受的值: false, true
--request-body

使用此 Web 測試傳送的 Base64 編碼字串主體。

--request-url

要測試的URL位置。

--retry-enabled

如果此 WebTest 失敗,請允許重試。

接受的值: false, true
--ssl-check

檢查 SSL 憑證是否仍然有效。

接受的值: false, true
--ssl-lifetime-check

在現有 SSL 憑證到期之前,仍要檢查的天數。 值必須是正數,且 SSLCheck 必須設定為 true。

--synthetic-monitor-id

此 WebTest 的唯一標識碼。 這通常與 [名稱] 欄位的值相同。

--tags

以空格分隔的標記:key[=value] [key[=value] ...]。使用 「清除現有的標記」。

--timeout

此 WebTest 逾時並失敗的秒數。 預設值為 30。

--web-test

要針對應用程式執行的 WebTest XML 規格。

--web-test-kind

這是 Web 測試的類型,有效的選擇是 ping、multistep 和 standard。

接受的值: multistep, ping, standard
全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az monitor app-insights web-test delete

刪除 Application Insights Web 測試。

az monitor app-insights web-test delete --name
                                        --resource-group
                                        [--yes]

範例

webTestDelete

az monitor app-insights web-test delete --resource-group "my-resource-group" --name "my-webtest-01-mywebservice"

必要參數

--name --web-test-name -n

Application Insights WebTest 資源的名稱。

--resource-group -g

資源群組的名稱。 您可以使用 來設定預設群組 az configure --defaults group=<name>

選擇性參數

--yes -y

不提示確認。

預設值: False
全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az monitor app-insights web-test list

取得針對指定元件定義的所有 Application Insights Web 測試。 以及取得指定資源群組內定義的所有 Application Insights Web 測試。 以及取得訂用帳戶內的所有ApplicationInsights 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

選擇性參數

--component-name

Application Insights 元件資源的名稱。

--resource-group -g

資源群組的名稱。 您可以使用 來設定預設群組 az configure --defaults group=<name>

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az monitor app-insights web-test show

取得特定的 Application Insights Web 測試定義。

az monitor app-insights web-test show --name
                                      --resource-group

範例

webTestGet

az monitor app-insights web-test show --resource-group "my-resource-group" --name "my-webtest-01-mywebservice"

必要參數

--name --web-test-name -n

Application Insights WebTest 資源的名稱。

--resource-group -g

資源群組的名稱。 您可以使用 來設定預設群組 az configure --defaults group=<name>

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az monitor app-insights web-test update

更新 Application Insights Web 測試定義。

az monitor app-insights web-test update --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"

必要參數

--name --web-test-name -n

Application Insights WebTest 資源的名稱。

--resource-group -g

資源群組的名稱。 您可以使用 來設定預設群組 az configure --defaults group=<name>

選擇性參數

--add

藉由指定路徑和索引鍵值組,將物件加入物件清單。 範例:--add property.listProperty <key=value, string or JSON string>

預設值: []
--content-validation

內容驗證屬性的集合。

使用方式:--content-validation content-match=XX ignore-case=XX pass-if-text-found=XX

content-match:在 WebTest 傳回中尋找的內容。 不得為 Null 或空白。 ignore-case:設定時,此值會使 ContentMatch 驗證案例不區分。 pass-if-text-found:如果 ContentMatch 字串相符,驗證將會通過。 如果為 false,如果相符,驗證將會失敗。

--defined-web-test-name

如果這個 WebTest,則為使用者定義的名稱。

--description

此 WebTest 的使用者定義描述。

--enabled

是否正在主動監視測試。

接受的值: false, true
--expected-status-code

驗證 WebTest 是否傳回提供的 HTTP 狀態代碼。

--follow-redirects

請遵循此 Web 測試的重新導向。

接受的值: false, true
--force-string

使用 'set' 或 'add' 時,請保留字串常值,而不是嘗試轉換成 JSON。

預設值: False
--frequency

此 WebTest 的測試回合之間以秒為單位的間隔。 預設值為 300。

--headers

要新增至 WebTest 呼叫的標頭及其值清單。

使用方式:--headers key=XX value=XX

機碼:標頭的名稱。 value:標頭的值。

您可以使用多個 --headers 自變數來指定多個動作。

--http-verb

要用於此 Web 測試的 Http 動詞。

--ignore-status-code

設定時,驗證會忽略狀態代碼。

接受的值: false, true
--kind

此 Web 測試所監看的 WebTest 種類。 選項為 ping 和 multistep。

接受的值: multistep, ping
--location -l

位置。​​ 來自的值: az account list-locations。 您可以使用 az configure --defaults location=<location> 設定預設位置。

--locations

實際執行測試的來源清單,以提供應用程式輔助功能的全域涵蓋範圍。

使用量:--locations Id=XX

標識碼:要從中執行之 WebTest 的位置識別碼。

您可以使用多個 --locations 自變數來指定多個動作。

--parse-requests

剖析此 WebTest 的相依要求。

接受的值: false, true
--remove

從清單中移除屬性或專案。 範例: --remove property.list <indexToRemove>--remove propertyToRemove

預設值: []
--request-body

使用此 Web 測試傳送的 Base64 編碼字串主體。

--request-url

要測試的URL位置。

--retry-enabled

如果此 WebTest 失敗,請允許重試。

接受的值: false, true
--set

指定要設定的屬性路徑和值,以更新物件。 範例:--set property1.property2=<value>

預設值: []
--ssl-check

檢查 SSL 憑證是否仍然有效。

接受的值: false, true
--ssl-lifetime-check

在現有 SSL 憑證到期之前,仍要檢查的天數。 值必須是正數,且 SSLCheck 必須設定為 true。

--synthetic-monitor-id

此 WebTest 的唯一標識碼。 這通常與 [名稱] 欄位的值相同。

--tags

以空格分隔的標記:key[=value] [key[=value] ...]。使用 「清除現有的標記」。

--timeout

此 WebTest 逾時並失敗的秒數。 預設值為 30。

--web-test

要針對應用程式執行的 WebTest XML 規格。

--web-test-kind

這是 Web 測試的類型,有效的選擇是 ping、multistep 和 standard。

接受的值: multistep, ping, standard
全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。