az connectedmachine run-command
Note
此参考是 Azure CLI(版本 2.75.0 或更高版本) 的 connectedmachine 扩展的一部分。 该扩展将在首次运行 az connectedmachine run-command 命令时自动安装。 了解更多关于扩展的信息。
此命令组处于预览状态,正在开发中。 参考和支持级别:https://aka.ms/CLI_refstatus
管理 Azure Arc-Enabled 服务器上的运行命令。
命令
| 名称 | 说明 | 类型 | Status |
|---|---|---|---|
| az connectedmachine run-command create |
创建运行命令。 |
Extension | Preview |
| az connectedmachine run-command delete |
删除运行命令。 |
Extension | Preview |
| az connectedmachine run-command list |
获取非 Azure 计算机的所有运行命令。 |
Extension | Preview |
| az connectedmachine run-command show |
获取运行命令。 |
Extension | Preview |
| az connectedmachine run-command update |
用于创建或更新运行命令的更新作。 |
Extension | Preview |
| az connectedmachine run-command wait |
将 CLI 置于等待状态,直到满足条件。 |
Extension | Preview |
az connectedmachine run-command create
命令组“az connectedmachine run-command”处于预览状态,正在开发中。 参考和支持级别:https://aka.ms/CLI_refstatus
创建运行命令。
az connectedmachine run-command create --machine-name
--name --run-command-name
--resource-group
[--async-execution {0, 1, f, false, n, no, t, true, y, yes}]
[--command-id]
[--error-blob-id --error-blob-managed-identity]
[--error-blob-uri]
[--location]
[--no-wait {0, 1, f, false, n, no, t, true, y, yes}]
[--output-blob-id --output-blob-managed-identity]
[--output-blob-uri]
[--parameters]
[--protected-parameters]
[--run-as-password]
[--run-as-user]
[--script]
[--script-uri]
[--script-uri-id --script-uri-managed-identity]
[--tags]
[--timeout-in-seconds]
示例
用于运行命令创建的示例命令
az connectedmachine run-command create --resource-group myResourceGroup --location "WestUS" --async false --parameters "[{"name":"param1","value":"value1"}]" --password "<runAsPassword>" --user "user1" --script "Write-Host Hello World!" --timeout 3600 --name myRunCommand --machine-name myMachine --subscription mySubscription
az connectedmachine run-command create --resource-group myResourceGroup --location "WestUS" --script "Write-Host Hello World!" --name myRunCommand --machine-name myMachine --output-uri "outputuri" --subscription mySubscription
必需参数
混合计算机的名称。
run 命令的名称。
资源组的名称。 可以使用 az configure --defaults group=<name>配置默认组。
可选参数
以下参数是可选的,但根据上下文,命令可能需要一个或多个参数才能成功执行。
Optional. 如果设置为 true,则脚本启动后预配将立即完成,并且不会等待脚本完成。
| 属性 | 值 |
|---|---|
| 参数组: | Properties Arguments |
| 默认值: | False |
| 接受的值: | 0, 1, f, false, n, no, t, true, y, yes |
指定预定义内置脚本的 commandId。
| 属性 | 值 |
|---|---|
| 参数组: | Source Arguments |
用户分配的托管标识有权访问 errorBlobUri 存储 Blob。 在系统分配的标识的情况下使用空对象。 确保已向托管标识授予对具有“存储 Blob 数据参与者”角色分配的 Blob 容器的访问权限。 对于用户分配的标识,请确保将其添加到 VM 的标识下。 有关托管标识和运行命令的详细信息,请参阅 https://aka.ms/ManagedIdentity 和 https://aka.ms/RunCommandManaged 支持速记语法、json-file 和 yaml-file。 请尝试“??” 以显示更多内容。
| 属性 | 值 |
|---|---|
| 参数组: | Properties Arguments |
指定将上传脚本错误流的 Azure 存储 Blob。 使用具有读取、追加、创建、写入访问权限的 SAS URI 或使用托管标识提供对 Blob 的 VM 访问权限。 引用 errorBlobManagedIdentity 参数。
| 属性 | 值 |
|---|---|
| 参数组: | Properties Arguments |
未指定资源所在的地理位置,将使用资源组的位置。
| 属性 | 值 |
|---|---|
| 参数组: | RunCommandProperties Arguments |
不等待长时间运行的操作完成。
| 属性 | 值 |
|---|---|
| 接受的值: | 0, 1, f, false, n, no, t, true, y, yes |
用户分配的托管标识有权访问 outputBlobUri 存储 Blob。 在系统分配的标识的情况下使用空对象。 确保已向托管标识授予对具有“存储 Blob 数据参与者”角色分配的 Blob 容器的访问权限。 对于用户分配的标识,请确保将其添加到 VM 的标识下。 有关托管标识和运行命令的详细信息,请参阅 https://aka.ms/ManagedIdentity 和 https://aka.ms/RunCommandManaged 支持速记语法、json-file 和 yaml-file。 请尝试“??” 以显示更多内容。
| 属性 | 值 |
|---|---|
| 参数组: | Properties Arguments |
指定将上传脚本输出流的 Azure 存储 Blob。 使用具有读取、追加、创建、写入访问权限的 SAS URI 或使用托管标识提供对 Blob 的 VM 访问权限。 引用 outputBlobManagedIdentity 参数。
| 属性 | 值 |
|---|---|
| 参数组: | Properties Arguments |
脚本使用的参数。 支持速记语法、json-file 和 yaml-file。 请尝试“??” 以显示更多内容。
| 属性 | 值 |
|---|---|
| 参数组: | Properties Arguments |
脚本使用的参数。 支持速记语法、json-file 和 yaml-file。 请尝试“??” 以显示更多内容。
| 属性 | 值 |
|---|---|
| 参数组: | Properties Arguments |
在执行 run 命令时,指定计算机上的用户帐户密码。
| 属性 | 值 |
|---|---|
| 参数组: | Properties Arguments |
在执行 run 命令时,指定计算机上的用户帐户。
| 属性 | 值 |
|---|---|
| 参数组: | Properties Arguments |
指定要在计算机上执行的脚本内容。
| 属性 | 值 |
|---|---|
| 参数组: | Source Arguments |
指定脚本下载位置。 它可以是具有读取访问权限或公共 URI 的 Azure 存储 Blob 的 SAS URI。
| 属性 | 值 |
|---|---|
| 参数组: | Source Arguments |
对于 Azure 存储 Blob,用户分配的托管标识有权访问 scriptUri。 在系统分配的标识的情况下使用空对象。 确保 Azure 存储 Blob 存在,并且已向托管标识授予对具有“存储 Blob 数据读取者”角色分配的 Blob 容器的访问权限。 对于用户分配的标识,请确保将其添加到 VM 的标识下。 有关托管标识和运行命令的详细信息,请参阅 https://aka.ms/ManagedIdentity 和 https://aka.ms/RunCommandManaged。 支持速记语法、json-file 和 yaml-file。 请尝试“??” 以显示更多内容。
| 属性 | 值 |
|---|---|
| 参数组: | Source Arguments |
资源标记。 支持速记语法、json-file 和 yaml-file。 请尝试“??” 以显示更多内容。
| 属性 | 值 |
|---|---|
| 参数组: | RunCommandProperties Arguments |
执行 run 命令的超时(以秒为单位)。
| 属性 | 值 |
|---|---|
| 参数组: | Properties Arguments |
全局参数
提高日志记录详细程度以显示所有调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
| 属性 | 值 |
|---|---|
| 默认值: | False |
输出格式。
| 属性 | 值 |
|---|---|
| 默认值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |
az connectedmachine run-command delete
命令组“az connectedmachine run-command”处于预览状态,正在开发中。 参考和支持级别:https://aka.ms/CLI_refstatus
删除运行命令。
az connectedmachine run-command delete [--ids]
[--machine-name]
[--name --run-command-name]
[--no-wait {0, 1, f, false, n, no, t, true, y, yes}]
[--resource-group]
[--subscription]
[--yes]
示例
用于运行命令删除的示例命令
az connectedmachine run-command delete --resource-group myResourceGroup --machine-name myMachine --name myRunCommand
可选参数
以下参数是可选的,但根据上下文,命令可能需要一个或多个参数才能成功执行。
一个或多个资源 ID(以空格分隔)。 它应该是包含“Resource Id”参数的所有信息的完整资源 ID。 应提供 --ids 或其他“Resource Id”参数。
| 属性 | 值 |
|---|---|
| 参数组: | Resource Id Arguments |
混合计算机的名称。
| 属性 | 值 |
|---|---|
| 参数组: | Resource Id Arguments |
run 命令的名称。
| 属性 | 值 |
|---|---|
| 参数组: | Resource Id Arguments |
不等待长时间运行的操作完成。
| 属性 | 值 |
|---|---|
| 接受的值: | 0, 1, f, false, n, no, t, true, y, yes |
资源组的名称。 可以使用 az configure --defaults group=<name>配置默认组。
| 属性 | 值 |
|---|---|
| 参数组: | Resource Id Arguments |
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。
| 属性 | 值 |
|---|---|
| 参数组: | Resource Id Arguments |
不要提示确认。
| 属性 | 值 |
|---|---|
| 默认值: | False |
全局参数
提高日志记录详细程度以显示所有调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
| 属性 | 值 |
|---|---|
| 默认值: | False |
输出格式。
| 属性 | 值 |
|---|---|
| 默认值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |
az connectedmachine run-command list
命令组“az connectedmachine run-command”处于预览状态,正在开发中。 参考和支持级别:https://aka.ms/CLI_refstatus
获取非 Azure 计算机的所有运行命令。
az connectedmachine run-command list --machine-name
--resource-group
[--expand]
[--max-items]
[--next-token]
示例
Run-command 列表的示例命令
az connectedmachine run-command list --resource-group myResourceGroup --machine-name myMachine --subscription mySubscription
必需参数
混合计算机的名称。
资源组的名称。 可以使用 az configure --defaults group=<name>配置默认组。
可选参数
以下参数是可选的,但根据上下文,命令可能需要一个或多个参数才能成功执行。
要应用于作的展开表达式。
命令输出中要返回的项总数。 如果可用的项总数大于指定的值,则会在命令的输出中提供令牌。 若要恢复分页,请在后续命令的 --next-token 参数中提供令牌值。
| 属性 | 值 |
|---|---|
| 参数组: | Pagination Arguments |
用于指定开始分页的位置的令牌。 这是先前截断的响应中的令牌值。
| 属性 | 值 |
|---|---|
| 参数组: | Pagination Arguments |
全局参数
提高日志记录详细程度以显示所有调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
| 属性 | 值 |
|---|---|
| 默认值: | False |
输出格式。
| 属性 | 值 |
|---|---|
| 默认值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |
az connectedmachine run-command show
命令组“az connectedmachine run-command”处于预览状态,正在开发中。 参考和支持级别:https://aka.ms/CLI_refstatus
获取运行命令。
az connectedmachine run-command show [--ids]
[--machine-name]
[--name --run-command-name]
[--resource-group]
[--subscription]
示例
run-command show 的示例命令
az connectedmachine run-command show --resource-group myResourceGroup --machine-name myMachine --name myRunCommand
可选参数
以下参数是可选的,但根据上下文,命令可能需要一个或多个参数才能成功执行。
一个或多个资源 ID(以空格分隔)。 它应该是包含“Resource Id”参数的所有信息的完整资源 ID。 应提供 --ids 或其他“Resource Id”参数。
| 属性 | 值 |
|---|---|
| 参数组: | Resource Id Arguments |
混合计算机的名称。
| 属性 | 值 |
|---|---|
| 参数组: | Resource Id Arguments |
run 命令的名称。
| 属性 | 值 |
|---|---|
| 参数组: | Resource Id Arguments |
资源组的名称。 可以使用 az configure --defaults group=<name>配置默认组。
| 属性 | 值 |
|---|---|
| 参数组: | Resource Id Arguments |
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。
| 属性 | 值 |
|---|---|
| 参数组: | Resource Id Arguments |
全局参数
提高日志记录详细程度以显示所有调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
| 属性 | 值 |
|---|---|
| 默认值: | False |
输出格式。
| 属性 | 值 |
|---|---|
| 默认值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |
az connectedmachine run-command update
命令组“az connectedmachine run-command”处于预览状态,正在开发中。 参考和支持级别:https://aka.ms/CLI_refstatus
用于创建或更新运行命令的更新作。
az connectedmachine run-command update [--add]
[--async-execution {0, 1, f, false, n, no, t, true, y, yes}]
[--error-blob-id --error-blob-managed-identity]
[--error-blob-uri]
[--force-string {0, 1, f, false, n, no, t, true, y, yes}]
[--ids]
[--machine-name]
[--name --run-command-name]
[--no-wait {0, 1, f, false, n, no, t, true, y, yes}]
[--output-blob-id --output-blob-managed-identity]
[--output-blob-uri]
[--parameters]
[--protected-parameters]
[--remove]
[--resource-group]
[--run-as-password]
[--run-as-user]
[--set]
[--source]
[--subscription]
[--tags]
[--timeout-in-seconds]
示例
run-command update 的示例命令
az connetcedmachine run-command update --resource-group myResourceGroup --name myRunCommand --machine-name myMachine --subscription mySubscription --tags Tag1=Value1
可选参数
以下参数是可选的,但根据上下文,命令可能需要一个或多个参数才能成功执行。
通过指定路径和键值对将对象添加到对象列表。 示例:--add property.listProperty <key=value, string or JSON string>。
| 属性 | 值 |
|---|---|
| 参数组: | Generic Update Arguments |
Optional. 如果设置为 true,则脚本启动后预配将立即完成,并且不会等待脚本完成。
| 属性 | 值 |
|---|---|
| 参数组: | Properties Arguments |
| 接受的值: | 0, 1, f, false, n, no, t, true, y, yes |
用户分配的托管标识有权访问 errorBlobUri 存储 Blob。 在系统分配的标识的情况下使用空对象。 确保已向托管标识授予对具有“存储 Blob 数据参与者”角色分配的 Blob 容器的访问权限。 对于用户分配的标识,请确保将其添加到 VM 的标识下。 有关托管标识和运行命令的详细信息,请参阅 https://aka.ms/ManagedIdentity 和 https://aka.ms/RunCommandManaged 支持速记语法、json-file 和 yaml-file。 请尝试“??” 以显示更多内容。
| 属性 | 值 |
|---|---|
| 参数组: | Properties Arguments |
指定将上传脚本错误流的 Azure 存储 Blob。 使用具有读取、追加、创建、写入访问权限的 SAS URI 或使用托管标识提供对 Blob 的 VM 访问权限。 引用 errorBlobManagedIdentity 参数。
| 属性 | 值 |
|---|---|
| 参数组: | Properties Arguments |
使用“set”或“add”时,保留字符串文本,而不是尝试转换为 JSON。
| 属性 | 值 |
|---|---|
| 参数组: | Generic Update Arguments |
| 接受的值: | 0, 1, f, false, n, no, t, true, y, yes |
一个或多个资源 ID(以空格分隔)。 它应该是包含“Resource Id”参数的所有信息的完整资源 ID。 应提供 --ids 或其他“Resource Id”参数。
| 属性 | 值 |
|---|---|
| 参数组: | Resource Id Arguments |
混合计算机的名称。
| 属性 | 值 |
|---|---|
| 参数组: | Resource Id Arguments |
run 命令的名称。
| 属性 | 值 |
|---|---|
| 参数组: | Resource Id Arguments |
不等待长时间运行的操作完成。
| 属性 | 值 |
|---|---|
| 接受的值: | 0, 1, f, false, n, no, t, true, y, yes |
用户分配的托管标识有权访问 outputBlobUri 存储 Blob。 在系统分配的标识的情况下使用空对象。 确保已向托管标识授予对具有“存储 Blob 数据参与者”角色分配的 Blob 容器的访问权限。 对于用户分配的标识,请确保将其添加到 VM 的标识下。 有关托管标识和运行命令的详细信息,请参阅 https://aka.ms/ManagedIdentity 和 https://aka.ms/RunCommandManaged 支持速记语法、json-file 和 yaml-file。 请尝试“??” 以显示更多内容。
| 属性 | 值 |
|---|---|
| 参数组: | Properties Arguments |
指定将上传脚本输出流的 Azure 存储 Blob。 使用具有读取、追加、创建、写入访问权限的 SAS URI 或使用托管标识提供对 Blob 的 VM 访问权限。 引用 outputBlobManagedIdentity 参数。
| 属性 | 值 |
|---|---|
| 参数组: | Properties Arguments |
脚本使用的参数。 支持速记语法、json-file 和 yaml-file。 请尝试“??” 以显示更多内容。
| 属性 | 值 |
|---|---|
| 参数组: | Properties Arguments |
脚本使用的参数。 支持速记语法、json-file 和 yaml-file。 请尝试“??” 以显示更多内容。
| 属性 | 值 |
|---|---|
| 参数组: | Properties Arguments |
从列表中删除属性或元素。 示例: --remove property.list <indexToRemove> OR --remove propertyToRemove.
| 属性 | 值 |
|---|---|
| 参数组: | Generic Update Arguments |
资源组的名称。 可以使用 az configure --defaults group=<name>配置默认组。
| 属性 | 值 |
|---|---|
| 参数组: | Resource Id Arguments |
在执行 run 命令时,指定计算机上的用户帐户密码。
| 属性 | 值 |
|---|---|
| 参数组: | Properties Arguments |
在执行 run 命令时,指定计算机上的用户帐户。
| 属性 | 值 |
|---|---|
| 参数组: | Properties Arguments |
通过指定要设置的属性路径和值来更新对象。 示例:--set property1.property2=<value>。
| 属性 | 值 |
|---|---|
| 参数组: | Generic Update Arguments |
运行命令脚本的源。 支持速记语法、json-file 和 yaml-file。 请尝试“??” 以显示更多内容。
| 属性 | 值 |
|---|---|
| 参数组: | Properties Arguments |
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。
| 属性 | 值 |
|---|---|
| 参数组: | Resource Id Arguments |
资源标记。 支持速记语法、json-file 和 yaml-file。 请尝试“??” 以显示更多内容。
| 属性 | 值 |
|---|---|
| 参数组: | RunCommandProperties Arguments |
执行 run 命令的超时(以秒为单位)。
| 属性 | 值 |
|---|---|
| 参数组: | Properties Arguments |
全局参数
提高日志记录详细程度以显示所有调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
| 属性 | 值 |
|---|---|
| 默认值: | False |
输出格式。
| 属性 | 值 |
|---|---|
| 默认值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |
az connectedmachine run-command wait
命令组“az connectedmachine run-command”处于预览状态,正在开发中。 参考和支持级别:https://aka.ms/CLI_refstatus
将 CLI 置于等待状态,直到满足条件。
az connectedmachine run-command wait [--created]
[--custom]
[--deleted]
[--exists]
[--ids]
[--interval]
[--machine-name]
[--name --run-command-name]
[--resource-group]
[--subscription]
[--timeout]
[--updated]
可选参数
以下参数是可选的,但根据上下文,命令可能需要一个或多个参数才能成功执行。
等待在“Succeeded”中使用“provisioningState”创建。
| 属性 | 值 |
|---|---|
| 参数组: | Wait Condition Arguments |
| 默认值: | False |
等待条件满足自定义 JMESPath 查询。 例如 provisioningState!='InProgress', instanceView.statuses[?code=='PowerState/running']。
| 属性 | 值 |
|---|---|
| 参数组: | Wait Condition Arguments |
等到删除为止。
| 属性 | 值 |
|---|---|
| 参数组: | Wait Condition Arguments |
| 默认值: | False |
等待资源存在。
| 属性 | 值 |
|---|---|
| 参数组: | Wait Condition Arguments |
| 默认值: | False |
一个或多个资源 ID(以空格分隔)。 它应该是包含“Resource Id”参数的所有信息的完整资源 ID。 应提供 --ids 或其他“Resource Id”参数。
| 属性 | 值 |
|---|---|
| 参数组: | Resource Id Arguments |
轮询间隔(以秒为单位)。
| 属性 | 值 |
|---|---|
| 参数组: | Wait Condition Arguments |
| 默认值: | 30 |
混合计算机的名称。
| 属性 | 值 |
|---|---|
| 参数组: | Resource Id Arguments |
run 命令的名称。
| 属性 | 值 |
|---|---|
| 参数组: | Resource Id Arguments |
资源组的名称。 可以使用 az configure --defaults group=<name>配置默认组。
| 属性 | 值 |
|---|---|
| 参数组: | Resource Id Arguments |
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。
| 属性 | 值 |
|---|---|
| 参数组: | Resource Id Arguments |
最大等待(以秒为单位)。
| 属性 | 值 |
|---|---|
| 参数组: | Wait Condition Arguments |
| 默认值: | 3600 |
等到 provisioningState 更新为“Succeeded”。
| 属性 | 值 |
|---|---|
| 参数组: | Wait Condition Arguments |
| 默认值: | False |
全局参数
提高日志记录详细程度以显示所有调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
| 属性 | 值 |
|---|---|
| 默认值: | False |
输出格式。
| 属性 | 值 |
|---|---|
| 默认值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |