az vmss run-command
仮想マシン スケール セットで実行コマンドを管理します。
詳細については、https://learn.microsoft.com/azure/virtual-machines/windows/run-command または https://learn.microsoft.com/azure/virtual-machines/linux/run-commandを参照してください。
コマンド
名前 | 説明 | 型 | 状態 |
---|---|---|---|
az vmss run-command create |
VMSS VM 実行コマンドを作成する操作。 |
Core | GA |
az vmss run-command delete |
実行コマンドを削除する操作。 |
Core | GA |
az vmss run-command invoke |
仮想マシン スケール セット インスタンスで特定の実行コマンドを実行します。 |
Core | GA |
az vmss run-command list |
仮想マシン スケールセット内のインスタンスのすべての実行コマンドを取得する操作。 |
Core | GA |
az vmss run-command show |
VMSS 実行コマンドを取得する操作。 |
Core | GA |
az vmss run-command update |
VMSS 実行コマンドを更新する操作。 |
Core | GA |
az vmss run-command create
VMSS VM 実行コマンドを作成する操作。
az vmss run-command create --instance-id
--name --run-command-name
--resource-group
--vmss-name
[--async-execution {false, true}]
[--command-id]
[--error-blob-uri]
[--location]
[--no-wait]
[--output-blob-uri]
[--parameters]
[--protected-parameters]
[--run-as-password]
[--run-as-user]
[--script]
[--script-uri]
[--tags]
[--timeout-in-seconds]
例
VMSS 実行コマンドを作成します。
az vmss run-command create --resource-group "myResourceGroup" --instance-id "0" --location "West US" --async-execution false --parameters arg1=param1 arg2=value1 --run-as-password "<runAsPassword>" --run-as-user "user1" --script "Write-Host Hello World!" --timeout-in-seconds 3600 --run-command-name "myRunCommand" --vmss-name "myVMSS"
必須のパラメーター
仮想マシンのインスタンス ID。
仮想マシンの実行コマンドの名前。
リソース グループの名前。
az configure --defaults group=<name>
を使用して既定のグループを構成できます。
VM スケール セットの名前。
省略可能のパラメーター
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
Optional. true に設定すると、スクリプトが開始されるとすぐにプロビジョニングが完了し、スクリプトが完了するまで待機しません。
プロパティ | 値 |
---|---|
指定可能な値: | false, true |
定義済みの組み込みスクリプトの commandId を指定します。
スクリプト エラー ストリームがアップロードされる追加 BLOB への URI (SAS なし)。
Location. 値のソース: az account list-locations
az configure --defaults location=<location>
を使用して、既定の場所を構成できます。
実行時間の長い操作が完了するまで待つ必要はありません。
プロパティ | 値 |
---|---|
規定値: | False |
スクリプト出力がアップロードされる追加 BLOB への URI (SAS なし)。
スクリプトで使用されるパラメーター。
使用法: --parameters arg1=XX arg2=XX。
スクリプトで使用されるパラメーター。
使用法: --protected-parameters credentials=somefoo secret=somebar。
ユーザーとしての実行パラメーターを使用するために必要な場合はパスワード。 暗号化され、ログに記録されません。
既定では、スクリプト プロセスはシステム/ルート ユーザーで実行されます。 プロセスをホストするカスタム ユーザーを指定します。
VM で実行するスクリプトコンテンツを指定します。
スクリプトのダウンロード場所を指定します。
スペース区切りのタグ: key[=value] [key[=value] ...]既存のタグをクリアするには、"" を使用します。
run コマンドを実行するためのタイムアウト (秒単位)。
グローバル パラメーター
ログの詳細度を上げて、すべてのデバッグ ログを表示します。
プロパティ | 値 |
---|---|
規定値: | 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 vmss run-command delete
実行コマンドを削除する操作。
az vmss run-command delete --name --run-command-name
[--ids]
[--instance-id]
[--no-wait]
[--resource-group]
[--subscription]
[--vmss-name]
[--yes]
例
VMSS 実行コマンドを削除する操作。
az vmss run-command delete --resource-group "myResourceGroup" --instance-id "0" --run-command-name "myRunCommand" --vmss-name "myVMSS"
必須のパラメーター
仮想マシンの実行コマンドの名前。
省略可能のパラメーター
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
1 つ以上のリソース ID (スペース区切り)。 これは、'Resource Id' 引数のすべての情報を含む完全なリソース ID である必要があります。 --ids または他の 'Resource Id' 引数を指定する必要があります。
プロパティ | 値 |
---|---|
Parameter group: | Resource Id Arguments |
仮想マシンのインスタンス ID。
プロパティ | 値 |
---|---|
Parameter group: | Resource Id Arguments |
実行時間の長い操作が完了するまで待つ必要はありません。
プロパティ | 値 |
---|---|
規定値: | False |
リソース グループの名前。
az configure --defaults group=<name>
を使用して既定のグループを構成できます。
プロパティ | 値 |
---|---|
Parameter group: | Resource Id Arguments |
サブスクリプションの名前または ID。
az account set -s NAME_OR_ID
を使用して既定のサブスクリプションを構成できます。
プロパティ | 値 |
---|---|
Parameter group: | Resource Id Arguments |
VM スケール セットの名前。
プロパティ | 値 |
---|---|
Parameter group: | Resource Id Arguments |
確認を求めないでください。
プロパティ | 値 |
---|---|
規定値: | False |
グローバル パラメーター
ログの詳細度を上げて、すべてのデバッグ ログを表示します。
プロパティ | 値 |
---|---|
規定値: | False |
このヘルプ メッセージを表示して終了します。
エラーのみを表示し、警告を抑制します。
プロパティ | 値 |
---|---|
規定値: | False |
Output format.
プロパティ | 値 |
---|---|
規定値: | json |
指定可能な値: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath クエリ文字列。 詳細と例については、http://jmespath.org/ を参照してください。
ログの詳細度を高める。 完全なデバッグ ログには --debug を使用します。
プロパティ | 値 |
---|---|
規定値: | False |
az vmss run-command invoke
仮想マシン スケール セット インスタンスで特定の実行コマンドを実行します。
az vmss run-command show
は、各実行コマンドに関する有用な情報を返します。
az vmss run-command list
を介してコマンド ID の実行を検出します。
az vmss run-command invoke --command-id
[--ids]
[--instance-id]
[--name]
[--parameters]
[--resource-group]
[--scripts]
[--subscription]
例
VMSS インスタンスに nginx をインストールします。
az vmss run-command invoke -g MyResourceGroup -n MyVMSS --command-id RunShellScript \ --instance-id 0 --scripts "sudo apt-get update && sudo apt-get install -y nginx"
VMSS インスタンスでパラメーターを指定して run-command を呼び出します。
az vmss run-command invoke -g MyResourceGroup -n MyVMSS --command-id RunShellScript \ --instance-id 4 --scripts 'echo $1 $2' --parameters hello world
VMSS インスタンス リソース ID を使用して、すべての VMSS インスタンスでコマンドを呼び出します。 注: "@-" は stdin に展開されます。
az vmss list-instances -n MyVMSS -g my-rg --query "[].id" --output tsv | \
az vmss run-command invoke --scripts 'echo $1 $2' --parameters hello world \
--command-id RunShellScript --ids @-
パラメーターを使用して Windows VMSS インスタンスで PowerShell スクリプトを実行します。 インラインで提供されるスクリプト。 CMD.exeでのシングルクォートに注意してください.
az vmss run-command invoke --command-id RunPowerShellScript --name win-vm -g my-resource-group \
--scripts 'param([string]$arg1,[string]$arg2)' \
'Write-Host This is a sample script with parameters $arg1 and $arg2' \
--parameters 'arg1=somefoo' 'arg2=somebar' --instance-id 2
パラメーターを使用して Windows VMSS インスタンスで PowerShell スクリプトを実行します。 ファイルから提供されるスクリプト。
# script.ps1
# param(
# [string]$arg1,
# [string]$arg2
# )
# Write-Host This is a sample script with parameters $arg1 and $arg2
az vmss run-command invoke --command-id RunPowerShellScript --name win-vm -g my-resource-group \
--scripts @script.ps1 --parameters "arg1=somefoo" "arg2=somebar" --instance-id 5
必須のパラメーター
コマンド ID。
プロパティ | 値 |
---|---|
値の取得元: | az vmss run-command list |
省略可能のパラメーター
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
1 つ以上のリソース ID (スペース区切り)。 これは、'Resource Id' 引数のすべての情報を含む完全なリソース ID である必要があります。 --ids または他の 'Resource Id' 引数を指定する必要があります。
プロパティ | 値 |
---|---|
Parameter group: | Resource Id Arguments |
スケール セット VM インスタンス ID。
プロパティ | 値 |
---|---|
Parameter group: | Resource Id Arguments |
スケール セット名。 既定値は、 az configure --defaults vmss=<name>
を使用して構成できます。
プロパティ | 値 |
---|---|
Parameter group: | Resource Id Arguments |
'[name=]value' の形式のスペース区切りパラメーター。
リソース グループの名前。
az configure --defaults group=<name>
を使用して既定のグループを構成できます。
プロパティ | 値 |
---|---|
Parameter group: | Resource Id Arguments |
スペース区切りのスクリプト行。 ファイルからスクリプトを読み込むには、@{file} を使用します。
サブスクリプションの名前または ID。
az account set -s NAME_OR_ID
を使用して既定のサブスクリプションを構成できます。
プロパティ | 値 |
---|---|
Parameter group: | Resource Id Arguments |
グローバル パラメーター
ログの詳細度を上げて、すべてのデバッグ ログを表示します。
プロパティ | 値 |
---|---|
規定値: | False |
このヘルプ メッセージを表示して終了します。
エラーのみを表示し、警告を抑制します。
プロパティ | 値 |
---|---|
規定値: | False |
Output format.
プロパティ | 値 |
---|---|
規定値: | json |
指定可能な値: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath クエリ文字列。 詳細と例については、http://jmespath.org/ を参照してください。
ログの詳細度を高める。 完全なデバッグ ログには --debug を使用します。
プロパティ | 値 |
---|---|
規定値: | False |
az vmss run-command list
仮想マシン スケールセット内のインスタンスのすべての実行コマンドを取得する操作。
az vmss run-command list --instance-id
--resource-group
--vmss-name
[--expand]
例
Vmss インスタンスの実行コマンドを一覧表示します。
az vmss run-command list --resource-group "myResourceGroup" --vmss-name "myVMSS" --instance-id "0"
必須のパラメーター
仮想マシンのインスタンス ID。
リソース グループの名前。
az configure --defaults group=<name>
を使用して既定のグループを構成できます。
VM スケール セットの名前。
省略可能のパラメーター
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
操作に適用する展開式。
グローバル パラメーター
ログの詳細度を上げて、すべてのデバッグ ログを表示します。
プロパティ | 値 |
---|---|
規定値: | 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 vmss run-command show
VMSS 実行コマンドを取得する操作。
az vmss run-command show --name --run-command-name
[--ids]
[--instance-id]
[--instance-view]
[--resource-group]
[--subscription]
[--vmss-name]
例
VMSS 実行コマンドを取得します。
az vmss run-command show --instance-id "0" --resource-group "myResourceGroup" --run-command-name "myRunCommand" --vmss-name "myVMSS"
必須のパラメーター
仮想マシンの実行コマンドの名前。
省略可能のパラメーター
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
1 つ以上のリソース ID (スペース区切り)。 これは、'Resource Id' 引数のすべての情報を含む完全なリソース ID である必要があります。 --ids または他の 'Resource Id' 引数を指定する必要があります。
プロパティ | 値 |
---|---|
Parameter group: | Resource Id Arguments |
仮想マシンのインスタンス ID。
プロパティ | 値 |
---|---|
Parameter group: | Resource Id Arguments |
実行コマンドのインスタンス ビュー。
プロパティ | 値 |
---|---|
規定値: | False |
リソース グループの名前。
az configure --defaults group=<name>
を使用して既定のグループを構成できます。
プロパティ | 値 |
---|---|
Parameter group: | Resource Id Arguments |
サブスクリプションの名前または ID。
az account set -s NAME_OR_ID
を使用して既定のサブスクリプションを構成できます。
プロパティ | 値 |
---|---|
Parameter group: | Resource Id Arguments |
VM スケール セットの名前。
プロパティ | 値 |
---|---|
Parameter group: | Resource Id Arguments |
グローバル パラメーター
ログの詳細度を上げて、すべてのデバッグ ログを表示します。
プロパティ | 値 |
---|---|
規定値: | False |
このヘルプ メッセージを表示して終了します。
エラーのみを表示し、警告を抑制します。
プロパティ | 値 |
---|---|
規定値: | False |
Output format.
プロパティ | 値 |
---|---|
規定値: | json |
指定可能な値: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath クエリ文字列。 詳細と例については、http://jmespath.org/ を参照してください。
ログの詳細度を高める。 完全なデバッグ ログには --debug を使用します。
プロパティ | 値 |
---|---|
規定値: | False |
az vmss run-command update
VMSS 実行コマンドを更新する操作。
az vmss run-command update --name --run-command-name
[--async-execution {false, true}]
[--command-id]
[--error-blob-uri]
[--ids]
[--instance-id]
[--location]
[--no-wait]
[--output-blob-uri]
[--parameters]
[--protected-parameters]
[--resource-group]
[--run-as-password]
[--run-as-user]
[--script]
[--script-uri]
[--subscription]
[--tags]
[--timeout-in-seconds]
[--vmss-name]
例
VMSS 実行コマンドを更新します。
az vmss run-command update --resource-group "myResourceGroup" --instance-id "0" --location "West US" --async-execution false --parameters arg1=param1 arg2=value1 --run-as-password "<runAsPassword>" --run-as-user "user1" --script "Write-Host Hello World!" --timeout-in-seconds 3600 --run-command-name "myRunCommand" --vmss-name "myVMSS"
必須のパラメーター
仮想マシンの実行コマンドの名前。
省略可能のパラメーター
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
Optional. true に設定すると、スクリプトが開始されるとすぐにプロビジョニングが完了し、スクリプトが完了するまで待機しません。
プロパティ | 値 |
---|---|
指定可能な値: | false, true |
定義済みの組み込みスクリプトの commandId を指定します。
スクリプト エラー ストリームがアップロードされる追加 BLOB への URI (SAS なし)。
1 つ以上のリソース ID (スペース区切り)。 これは、'Resource Id' 引数のすべての情報を含む完全なリソース ID である必要があります。 --ids または他の 'Resource Id' 引数を指定する必要があります。
プロパティ | 値 |
---|---|
Parameter group: | Resource Id Arguments |
仮想マシンのインスタンス ID。
プロパティ | 値 |
---|---|
Parameter group: | Resource Id Arguments |
Location. 値のソース: az account list-locations
az configure --defaults location=<location>
を使用して、既定の場所を構成できます。
実行時間の長い操作が完了するまで待つ必要はありません。
プロパティ | 値 |
---|---|
規定値: | False |
スクリプト出力がアップロードされる追加 BLOB への URI (SAS なし)。
スクリプトで使用されるパラメーター。
使用法: --parameters arg1=XX arg2=XX。
スクリプトで使用されるパラメーター。
使用法: --protected-parameters credentials=somefoo secret=somebar。
リソース グループの名前。
az configure --defaults group=<name>
を使用して既定のグループを構成できます。
プロパティ | 値 |
---|---|
Parameter group: | Resource Id Arguments |
ユーザーとしての実行パラメーターを使用するために必要な場合はパスワード。 暗号化され、ログに記録されません。
既定では、スクリプト プロセスはシステム/ルート ユーザーで実行されます。 プロセスをホストするカスタム ユーザーを指定します。
VM で実行するスクリプトコンテンツを指定します。
スクリプトのダウンロード場所を指定します。
サブスクリプションの名前または ID。
az account set -s NAME_OR_ID
を使用して既定のサブスクリプションを構成できます。
プロパティ | 値 |
---|---|
Parameter group: | Resource Id Arguments |
スペース区切りのタグ: key[=value] [key[=value] ...]既存のタグをクリアするには、"" を使用します。
run コマンドを実行するためのタイムアウト (秒単位)。
VM スケール セットの名前。
プロパティ | 値 |
---|---|
Parameter group: | Resource Id Arguments |
グローバル パラメーター
ログの詳細度を上げて、すべてのデバッグ ログを表示します。
プロパティ | 値 |
---|---|
規定値: | False |
このヘルプ メッセージを表示して終了します。
エラーのみを表示し、警告を抑制します。
プロパティ | 値 |
---|---|
規定値: | False |
Output format.
プロパティ | 値 |
---|---|
規定値: | json |
指定可能な値: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath クエリ文字列。 詳細と例については、http://jmespath.org/ を参照してください。
ログの詳細度を高める。 完全なデバッグ ログには --debug を使用します。
プロパティ | 値 |
---|---|
規定値: | False |