az monitor app-insights web-test
備註
此參考是 Azure CLI 的 application-insights 擴充功能的一部分(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
必要參數
Application Insights WebTest 資源的名稱。
資源組名。 您可以使用 az configure --defaults group=<name>
來設定預設群組。
選擇性參數
內容驗證屬性的集合。
使用方式:--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,如果相符,驗證將會失敗。
如果這個 WebTest,則為使用者定義的名稱。
此 WebTest 的使用者定義描述。
是否正在主動監視測試。
驗證 WebTest 是否傳回提供的 HTTP 狀態代碼。
請遵循此 Web 測試的重新導向。
此 WebTest 的測試回合之間以秒為單位的間隔。 預設值為 300。
要新增至 WebTest 呼叫的標頭及其值清單。
使用方式:--headers key=XX value=XX
機碼:標頭的名稱。 value:標頭的值。
您可以使用多個 --headers 自變數來指定多個動作。
要用於此 Web 測試的 Http 動詞。
設定時,驗證會忽略狀態代碼。
此 Web 測試所監看的 WebTest 種類。 選項為 ping 和 multistep。
位置。 值的來源:az account list-locations
。 您可以使用 az configure --defaults location=<location>
來設定預設位置。
實際執行測試的來源清單,以提供應用程式輔助功能的全域涵蓋範圍。
使用量:--locations Id=XX
標識碼:要從中執行之 WebTest 的位置識別碼。
您可以使用多個 --locations 自變數來指定多個動作。
剖析此 WebTest 的相依要求。
使用此 Web 測試傳送的 Base64 編碼字串主體。
要測試的URL位置。
如果此 WebTest 失敗,請允許重試。
檢查 SSL 憑證是否仍然有效。
在現有 SSL 憑證到期之前,仍要檢查的天數。 值必須是正數,且 SSLCheck 必須設定為 true。
此 WebTest 的唯一標識碼。 這通常與 [名稱] 欄位的值相同。
以空格分隔的標記:key[=value] [key[=value] ...]。使用 「清除現有的標記」。
此 WebTest 逾時並失敗的秒數。 預設值為 30。
要針對應用程式執行的 WebTest XML 規格。
這是 Web 測試的類型,有效的選擇是 ping、multistep 和 standard。
全域參數
提高日誌詳細程度以顯示所有調試日誌。
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
輸出格式。
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID
來設定預設訂用帳戶。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --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"
必要參數
Application Insights WebTest 資源的名稱。
資源組名。 您可以使用 az configure --defaults group=<name>
來設定預設群組。
選擇性參數
請勿提示確認。
全域參數
提高日誌詳細程度以顯示所有調試日誌。
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
輸出格式。
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID
來設定預設訂用帳戶。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --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
選擇性參數
Application Insights 元件資源的名稱。
資源組名。 您可以使用 az configure --defaults group=<name>
來設定預設群組。
全域參數
提高日誌詳細程度以顯示所有調試日誌。
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
輸出格式。
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID
來設定預設訂用帳戶。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --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"
必要參數
Application Insights WebTest 資源的名稱。
資源組名。 您可以使用 az configure --defaults group=<name>
來設定預設群組。
全域參數
提高日誌詳細程度以顯示所有調試日誌。
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
輸出格式。
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID
來設定預設訂用帳戶。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --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"
必要參數
Application Insights WebTest 資源的名稱。
資源組名。 您可以使用 az configure --defaults group=<name>
來設定預設群組。
選擇性參數
藉由指定路徑和索引鍵值組,將物件加入物件清單。 範例: --add property.listProperty <key=value, string or JSON string>
.
內容驗證屬性的集合。
使用方式:--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,如果相符,驗證將會失敗。
如果這個 WebTest,則為使用者定義的名稱。
此 WebTest 的使用者定義描述。
是否正在主動監視測試。
驗證 WebTest 是否傳回提供的 HTTP 狀態代碼。
請遵循此 Web 測試的重新導向。
使用 'set' 或 'add' 時,請保留字串常值,而不是嘗試轉換成 JSON。
此 WebTest 的測試回合之間以秒為單位的間隔。 預設值為 300。
要新增至 WebTest 呼叫的標頭及其值清單。
使用方式:--headers key=XX value=XX
機碼:標頭的名稱。 value:標頭的值。
您可以使用多個 --headers 自變數來指定多個動作。
要用於此 Web 測試的 Http 動詞。
設定時,驗證會忽略狀態代碼。
此 Web 測試所監看的 WebTest 種類。 選項為 ping 和 multistep。
位置。 值的來源:az account list-locations
。 您可以使用 az configure --defaults location=<location>
來設定預設位置。
實際執行測試的來源清單,以提供應用程式輔助功能的全域涵蓋範圍。
使用量:--locations Id=XX
標識碼:要從中執行之 WebTest 的位置識別碼。
您可以使用多個 --locations 自變數來指定多個動作。
剖析此 WebTest 的相依要求。
從清單中移除屬性或專案。 範例: --remove property.list <indexToRemove>
或 --remove propertyToRemove
。
使用此 Web 測試傳送的 Base64 編碼字串主體。
要測試的URL位置。
如果此 WebTest 失敗,請允許重試。
指定要設定的屬性路徑和值,以更新物件。 範例: --set property1.property2=<value>
.
檢查 SSL 憑證是否仍然有效。
在現有 SSL 憑證到期之前,仍要檢查的天數。 值必須是正數,且 SSLCheck 必須設定為 true。
此 WebTest 的唯一標識碼。 這通常與 [名稱] 欄位的值相同。
以空格分隔的標記:key[=value] [key[=value] ...]。使用 「清除現有的標記」。
此 WebTest 逾時並失敗的秒數。 預設值為 30。
要針對應用程式執行的 WebTest XML 規格。
這是 Web 測試的類型,有效的選擇是 ping、multistep 和 standard。
全域參數
提高日誌詳細程度以顯示所有調試日誌。
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
輸出格式。
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID
來設定預設訂用帳戶。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。