az load test

注意

此參考是 Azure CLI 的載入 延伸模組的一部分 (2.41.0 版或更高版本)。 擴充功能會在您第一次執行 az load test 命令時自動安裝。 深入了解擴充功能。

此命令群組處於預覽狀態,且正在開發中。 參考和支援層級: https://aka.ms/CLI_refstatus

管理負載測試的命令群組。

使用建立、更新、刪除、清單等來管理負載測試的命令群組。

命令

名稱 Description 類型 狀態
az load test app-component

管理應用程式元件的命令群組。

擴充 預覽版
az load test app-component add

將應用程式元件新增至測試。

擴充 預覽版
az load test app-component list

列出測試的所有應用程式元件。

擴充 預覽版
az load test app-component remove

從測試中移除指定的應用程式元件。

擴充 預覽版
az load test create

建立新的負載測試。

擴充 預覽版
az load test delete

刪除現有的負載測試。

擴充 預覽版
az load test download-files

下載現有負載測試的檔案。

擴充 預覽版
az load test file

測試檔案作業的命令群組。

擴充 預覽版
az load test file delete

從測試中刪除檔案。

擴充 預覽版
az load test file download

從測試下載檔案。

擴充 預覽版
az load test file list

列出測試中的所有檔案。

擴充 預覽版
az load test file upload

將檔案上傳至測試。

擴充 預覽版
az load test list

列出指定負載測試資源中的所有測試。

擴充 預覽版
az load test server-metric

管理伺服器計量的命令群組。

擴充 預覽版
az load test server-metric add

將伺服器計量新增至測試。

擴充 預覽版
az load test server-metric list

列出測試的所有伺服器計量。

擴充 預覽版
az load test server-metric remove

從測試中移除指定的伺服器計量。

擴充 預覽版
az load test show

顯示測試的詳細資料。

擴充 預覽版
az load test update

更新現有的負載測試。

擴充 預覽版

az load test create

預覽

命令群組 「負載測試」處於預覽狀態,且正在開發中。 參考和支援層級: https://aka.ms/CLI_refstatus

建立新的負載測試。

az load test create --load-test-resource
                    --test-id
                    [--certificate]
                    [--description]
                    [--display-name]
                    [--engine-instances]
                    [--env]
                    [--keyvault-reference-id]
                    [--load-test-config-file]
                    [--no-wait]
                    [--resource-group]
                    [--secret]
                    [--split-csv]
                    [--subnet-id]
                    [--test-plan]

範例

使用負載測試組態檔建立測試。

az load test create --load-test-resource sample-alt-resource --resource-group sample-rg --test-id sample-test-id --load-test-config-file ~/resources/sample-config.yaml

使用引數建立測試。

az load test create --test-id sample-test-id --load-test-resource sample-alt-resource --resource-group sample-rg --display-name "Sample Name" --description "Test description" --test-plan sample-jmx.jmx --engine-instances 1 --env rps=2 count=1

使用負載測試組態檔建立測試,並使用引數覆寫引擎實例和 env,而不要等待檔案上傳。

az load test create --load-test-resource sample-alt-resource --resource-group sample-rg --test-id sample-test-id --load-test-config-file ~/resources/sample-config.yaml --engine-instances 1 --env rps=2 count=1 --no-wait

使用秘密和環境變數建立測試。

az load test create --test-id sample-test-id --load-test-resource sample-alt-resource --resource-group sample-rg --display-name "Sample Name" --description "Test description" --test-plan sample-jmx.jmx --secret secret_name1=secret_uri1 secret_name2=secret_uri2 --env rps=2 count=1

使用使用者指派的受控識別來存取金鑰保存庫,建立具有秘密的測試。

az load test create --test-id sample-test-id --load-test-resource sample-alt-resource --resource-group sample-rg --display-name "Sample Name" --secret secret_name1=secret_uri1 secret_name2=secret_uri2 --keyvault-reference-id "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-rg/providers/microsoft.managedidentity/userassignedidentities/sample-mi"

在已啟用分割 CSV 選項的虛擬網絡中建立私人端點的測試。

az load test create --test-id sample-test-id --load-test-resource sample-alt-resource --resource-group sample-rg --display-name "Sample Name" --subnet-id "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-rg/providers/Microsoft.Network/virtualNetworks/SampleVMVNET/subnets/SampleVMSubnet" --split-csv true

必要參數

--load-test-resource --name -n

負載測試資源的名稱或 ARM 資源識別碼。

--test-id -t

負載測試的測試識別碼。

選擇性參數

--certificate

'key[=value]' 格式的單一憑證。 憑證應該以 PFX 格式儲存在 Azure 金鑰保存庫中,而且應該提供憑證識別碼做為值。

--description

負載測試的描述。

--display-name

負載測試的顯示名稱。

--engine-instances

測試應執行所在的引擎實例數目。

--env

以空格分隔的環境變數:key[=value] [key[=value] ...]。

--keyvault-reference-id

將用來存取金鑰保存庫的身分識別。

--load-test-config-file

負載測試組態檔的路徑。 請參閱 https://learn.microsoft.com/azure/load-testing/reference-test-config-yaml

--no-wait

請勿等候長時間執行的作業完成。

預設值: False
--resource-group -g

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

--secret

以空格分隔的秘密:key[=value] [key[=value] ...]。秘密應該儲存在 Azure 金鑰保存庫中,而秘密識別碼應以 值的形式提供。

--split-csv

將 CSV 檔案平均分割在引擎實例之間。

--subnet-id

要用於私人負載測試之子網的資源識別碼。

--test-plan

JMeter 腳本的路徑。

全域參數
--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 load test delete

預覽

命令群組 「負載測試」處於預覽狀態,且正在開發中。 參考和支援層級: https://aka.ms/CLI_refstatus

刪除現有的負載測試。

az load test delete --load-test-resource
                    --test-id
                    [--resource-group]
                    [--yes]

範例

刪除負載測試。

az load test delete --load-test-resource sample-alt-resource --resource-group sample-rg --test-id sample-existing-test-id

必要參數

--load-test-resource --name -n

負載測試資源的名稱或 ARM 資源識別碼。

--test-id -t

負載測試的測試識別碼。

選擇性參數

--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 load test download-files

預覽

命令群組 「負載測試」處於預覽狀態,且正在開發中。 參考和支援層級: https://aka.ms/CLI_refstatus

下載現有負載測試的檔案。

az load test download-files --load-test-resource
                            --path
                            --test-id
                            [--force]
                            [--resource-group]

範例

下載測試的所有檔案。 目錄應該已經存在。

az load test download-files --test-id sample-test-id --load-test-resource sample-alt-resource --resource-group sample-rg --path ~/downloads

如果不存在,請建立目錄來下載測試的所有檔案。

az load test download-files --test-id sample-test-id --load-test-resource sample-alt-resource --resource-group sample-rg --path "~/downloads/new folder" --force

必要參數

--load-test-resource --name -n

負載測試資源的名稱或 ARM 資源識別碼。

--path

要下載檔案之目錄的路徑。

--test-id -t

負載測試的測試識別碼。

選擇性參數

--force

強制執行命令。 如果目錄不存在,則會建立要下載檔案的目錄。

預設值: False
--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 load test list

預覽

命令群組 「負載測試」處於預覽狀態,且正在開發中。 參考和支援層級: https://aka.ms/CLI_refstatus

列出指定負載測試資源中的所有測試。

az load test list --load-test-resource
                  [--resource-group]

範例

列出資源中的所有負載測試。

az load test list --load-test-resource sample-alt-resource --resource-group sample-rg

必要參數

--load-test-resource --name -n

負載測試資源的名稱或 ARM 資源識別碼。

選擇性參數

--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 load test show

預覽

命令群組 「負載測試」處於預覽狀態,且正在開發中。 參考和支援層級: https://aka.ms/CLI_refstatus

顯示測試的詳細資料。

az load test show --load-test-resource
                  --test-id
                  [--resource-group]

範例

取得負載測試的詳細資料。

az load test show --test-id sample-test-id --load-test-resource sample-alt-resource --resource-group sample-rg

必要參數

--load-test-resource --name -n

負載測試資源的名稱或 ARM 資源識別碼。

--test-id -t

負載測試的測試識別碼。

選擇性參數

--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 load test update

預覽

命令群組 「負載測試」處於預覽狀態,且正在開發中。 參考和支援層級: https://aka.ms/CLI_refstatus

更新現有的負載測試。

az load test update --load-test-resource
                    --test-id
                    [--certificate]
                    [--description]
                    [--display-name]
                    [--engine-instances]
                    [--env]
                    [--keyvault-reference-id]
                    [--load-test-config-file]
                    [--no-wait]
                    [--resource-group]
                    [--secret]
                    [--split-csv]
                    [--subnet-id]
                    [--test-plan]

範例

使用負載測試組態檔更新測試,而不要等待檔案上傳。

az load test update --load-test-resource sample-alt-resource --resource-group sample-rg --test-id sample-existing-test-id --load-test-config-file ~/resources/sample-config.yaml --no-wait

更新測試的顯示名稱和描述。

az load test update --load-test-resource sample-alt-resource --resource-group sample-rg --test-id sample-existing-test-id --description "Test description" --display-name "Sample Name"

使用負載測試組態檔更新測試,並使用引數覆寫參數。

az load test update --load-test-resource sample-alt-resource --resource-group sample-rg --test-id sample-existing-test-id --load-test-config-file ~/resources/sample-config.yaml --engine-instances 1 --env name=value name=value

從測試中移除秘密。

az load test update --load-test-resource sample-alt-resource --resource-group sample-rg --test-id sample-existing-test-id --secret secret_name1=""

將金鑰保存庫參考身分識別更新為系統指派的受控識別。

az load test update --load-test-resource sample-alt-resource --resource-group sample-rg --test-id sample-existing-test-id --keyvault-reference-id null

必要參數

--load-test-resource --name -n

負載測試資源的名稱或 ARM 資源識別碼。

--test-id -t

負載測試的測試識別碼。

選擇性參數

--certificate

'key[=value]' 格式的單一憑證。 憑證應該以 PFX 格式儲存在 Azure 金鑰保存庫中,而且應該提供憑證識別碼做為值。使用 「」 清除現有的憑證。

--description

負載測試的描述。

--display-name

負載測試的顯示名稱。

--engine-instances

測試應執行所在的引擎實例數目。

--env

以空格分隔的環境變數:key[=value] [key[=value] ...]。使用 「」 清除現有的環境變數。

--keyvault-reference-id

將用來存取金鑰保存庫的身分識別。 提供 null 或使用 None 負載測試資源的系統指派身分識別。

--load-test-config-file

負載測試組態檔的路徑。 請參閱 https://learn.microsoft.com/azure/load-testing/reference-test-config-yaml

--no-wait

請勿等候長時間執行的作業完成。

預設值: False
--resource-group -g

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

--secret

以空格分隔的秘密:key[=value] [key[=value] ...]。秘密應該儲存在 Azure 金鑰保存庫中,而秘密識別碼應以 值的形式提供。使用 「」 清除現有的秘密。

--split-csv

將 CSV 檔案平均分割在引擎實例之間。

--subnet-id

要用於私人負載測試之子網的資源識別碼。

--test-plan

JMeter 腳本的路徑。

全域參數
--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 來取得完整偵錯記錄。