你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Microsoft.Compute virtualMachineScaleSets/virtualMachines/runCommands 2023-03-01
Bicep 资源定义
可以使用面向以下操作部署 virtualMachineScaleSets/virtualMachines/runCommands 资源类型:
- 资源组 - 请参阅 资源组部署命令
有关每个 API 版本中已更改属性的列表,请参阅 更改日志。
资源格式
若要创建 Microsoft.Compute/virtualMachineScaleSets/virtualMachines/runCommands 资源,请将以下 Bicep 添加到模板。
resource symbolicname 'Microsoft.Compute/virtualMachineScaleSets/virtualMachines/runCommands@2023-03-01' = {
name: 'string'
location: 'string'
tags: {
tagName1: 'tagValue1'
tagName2: 'tagValue2'
}
parent: resourceSymbolicName
properties: {
asyncExecution: bool
errorBlobManagedIdentity: {
clientId: 'string'
objectId: 'string'
}
errorBlobUri: 'string'
outputBlobManagedIdentity: {
clientId: 'string'
objectId: 'string'
}
outputBlobUri: 'string'
parameters: [
{
name: 'string'
value: 'string'
}
]
protectedParameters: [
{
name: 'string'
value: 'string'
}
]
runAsPassword: 'string'
runAsUser: 'string'
source: {
commandId: 'string'
script: 'string'
scriptUri: 'string'
scriptUriManagedIdentity: {
clientId: 'string'
objectId: 'string'
}
}
timeoutInSeconds: int
treatFailureAsDeploymentFailure: bool
}
}
属性值
virtualMachineScaleSets/virtualMachines/runCommands
名称 | 说明 | 值 |
---|---|---|
name | 资源名称 了解如何在 Bicep 中设置子资源的名称和类型。 |
字符串 (必需) |
location | 资源位置 | 字符串 (必需) |
标记 | 资源标记 | 标记名称和值的字典。 请参阅 模板中的标记 |
父级 (parent) | 在 Bicep 中,可以为子资源指定父资源。 仅当子资源在父资源外部声明时,才需要添加此属性。 有关详细信息,请参阅 父资源之外的子资源。 |
类型为 的资源的符号名称: virtualMachines |
properties | 描述虚拟机运行命令的属性。 | VirtualMachineRunCommandProperties |
VirtualMachineRunCommandProperties
名称 | 说明 | 值 |
---|---|---|
asyncExecution | 可选。 如果设置为 true,则脚本启动后,预配将立即完成,并且不会等待脚本完成。 | bool |
errorBlobManagedIdentity | 有权访问 errorBlobUri 存储 Blob 的用户分配的托管标识。 对于系统分配的标识,请使用空对象。 确保已向托管标识授予对 Blob 容器的访问权限,并分配了“存储 Blob 数据参与者”角色。 对于用户分配的标识,请确保将其添加到 VM 的标识下。 有关托管标识和运行命令的详细信息,请参阅 https://aka.ms/ManagedIdentity 和 https://aka.ms/RunCommandManaged |
RunCommandManagedIdentity |
errorBlobUri | 指定要在其中上传脚本错误流的 Azure 存储 Blob。 使用具有读取、追加、创建、写入访问权限的 SAS URI,或使用托管标识为 VM 提供对 Blob 的访问权限。 请参阅 errorBlobManagedIdentity 参数。 | 字符串 |
outputBlobManagedIdentity | 有权访问 outputBlobUri 存储 Blob 的用户分配的托管标识。 对于系统分配的标识,请使用空对象。 确保已向托管标识授予对 Blob 容器的访问权限,并分配了“存储 Blob 数据参与者”角色。 对于用户分配的标识,请确保将其添加到 VM 的标识下。 有关托管标识和运行命令的详细信息,请参阅 https://aka.ms/ManagedIdentity 和 https://aka.ms/RunCommandManaged |
RunCommandManagedIdentity |
outputBlobUri | 指定要在其中上传脚本输出流的 Azure 存储 Blob。 使用具有读取、追加、创建、写入访问权限的 SAS URI,或使用托管标识为 VM 提供对 Blob 的访问权限。 请参阅 outputBlobManagedIdentity 参数。 | 字符串 |
parameters | 脚本使用的参数。 | RunCommandInputParameter[] |
protectedParameters | 脚本使用的参数。 | RunCommandInputParameter[] |
runAsPassword | 指定执行 run 命令时 VM 上的用户帐户密码。 | 字符串 |
runAsUser | 指定执行 run 命令时 VM 上的用户帐户。 | string |
source | 运行命令脚本的源。 | VirtualMachineRunCommandScriptSource |
timeoutInSeconds | 执行 run 命令的超时时间(秒)。 | int |
treatFailureAsDeploymentFailure | 可选。 如果设置为 true,脚本中的任何失败都将使部署失败,ProvisioningState 将标记为“失败”。 如果设置为 false,ProvisioningState 将仅反映 run 命令是否由扩展平台运行,它不会指示脚本在脚本失败时是否失败。 在脚本失败的情况下,请参阅 run 命令的实例视图,以查看 executionMessage、output、error: https://aka.ms/runcommandmanaged#get-execution-status-and-results |
bool |
RunCommandManagedIdentity
名称 | 说明 | 值 |
---|---|---|
clientId | 客户端 ID (用户分配的托管标识) GUID 值。 如果提供了 ObjectId,则不应使用 ObjectId。 | 字符串 |
objectId | 对象 ID (用户分配的托管标识) GUID 值。 如果已提供,则不应使用 ClientId。 | 字符串 |
RunCommandInputParameter
名称 | 说明 | 值 |
---|---|---|
name | 运行命令参数名称。 | 字符串 (必需) |
value | 运行命令参数值。 | 字符串 (必需) |
VirtualMachineRunCommandScriptSource
名称 | 说明 | 值 |
---|---|---|
commandId | 指定预定义内置脚本的 commandId。 | string |
脚本 | 指定要在 VM 上执行的脚本内容。 | 字符串 |
scriptUri | 指定脚本下载位置。 它可以是具有读取访问权限的 Azure 存储 Blob 的 SAS URI,也可以是公共 URI。 | 字符串 |
scriptUriManagedIdentity | 对于 Azure 存储 Blob,用户分配的托管标识有权访问 scriptUri。 对于系统分配的标识,请使用空对象。 确保 Azure 存储 Blob 存在,并且已向托管标识授予对 Blob 容器的访问权限,并分配了“存储 Blob 数据读取者”角色。 对于用户分配的标识,请确保将其添加到 VM 的标识下。 有关托管标识和运行命令的详细信息,请参阅 https://aka.ms/ManagedIdentity 和 https://aka.ms/RunCommandManaged. |
RunCommandManagedIdentity |
ARM 模板资源定义
virtualMachineScaleSets/virtualMachines/runCommands 资源类型可以使用以下目标操作进行部署:
- 资源组 - 请参阅 资源组部署命令
有关每个 API 版本中更改的属性的列表,请参阅 更改日志。
资源格式
若要创建 Microsoft.Compute/virtualMachineScaleSets/virtualMachines/runCommands 资源,请将以下 JSON 添加到模板。
{
"type": "Microsoft.Compute/virtualMachineScaleSets/virtualMachines/runCommands",
"apiVersion": "2023-03-01",
"name": "string",
"location": "string",
"tags": {
"tagName1": "tagValue1",
"tagName2": "tagValue2"
},
"properties": {
"asyncExecution": "bool",
"errorBlobManagedIdentity": {
"clientId": "string",
"objectId": "string"
},
"errorBlobUri": "string",
"outputBlobManagedIdentity": {
"clientId": "string",
"objectId": "string"
},
"outputBlobUri": "string",
"parameters": [
{
"name": "string",
"value": "string"
}
],
"protectedParameters": [
{
"name": "string",
"value": "string"
}
],
"runAsPassword": "string",
"runAsUser": "string",
"source": {
"commandId": "string",
"script": "string",
"scriptUri": "string",
"scriptUriManagedIdentity": {
"clientId": "string",
"objectId": "string"
}
},
"timeoutInSeconds": "int",
"treatFailureAsDeploymentFailure": "bool"
}
}
属性值
virtualMachineScaleSets/virtualMachines/runCommands
名称 | 说明 | Value |
---|---|---|
type | 资源类型 | “Microsoft.Compute/virtualMachineScaleSets/virtualMachines/runCommands” |
apiVersion | 资源 API 版本 | '2023-03-01' |
name | 资源名称 了解如何在 JSON ARM 模板中为子资源设置名称和类型。 |
字符串 (必需) |
location | 资源位置 | 字符串 (必需) |
标记 | 资源标记 | 标记名称和值的字典。 请参阅 模板中的标记 |
properties | 描述虚拟机运行命令的属性。 | VirtualMachineRunCommandProperties |
VirtualMachineRunCommandProperties
名称 | 说明 | 值 |
---|---|---|
asyncExecution | 可选。 如果设置为 true,则脚本启动后,预配将立即完成,并且不会等待脚本完成。 | bool |
errorBlobManagedIdentity | 有权访问 errorBlobUri 存储 Blob 的用户分配的托管标识。 对于系统分配的标识,请使用空对象。 确保已向托管标识授予对 Blob 容器的访问权限,并分配了“存储 Blob 数据参与者”角色。 对于用户分配的标识,请确保将其添加到 VM 的标识下。 有关托管标识和运行命令的详细信息,请参阅 https://aka.ms/ManagedIdentity 和 https://aka.ms/RunCommandManaged |
RunCommandManagedIdentity |
errorBlobUri | 指定要在其中上传脚本错误流的 Azure 存储 Blob。 使用具有读取、追加、创建、写入访问权限的 SAS URI,或使用托管标识为 VM 提供对 Blob 的访问权限。 请参阅 errorBlobManagedIdentity 参数。 | 字符串 |
outputBlobManagedIdentity | 有权访问 outputBlobUri 存储 Blob 的用户分配的托管标识。 对于系统分配的标识,请使用空对象。 确保已向托管标识授予对 Blob 容器的访问权限,并分配了“存储 Blob 数据参与者”角色。 对于用户分配的标识,请确保将其添加到 VM 的标识下。 有关托管标识和运行命令的详细信息,请参阅 https://aka.ms/ManagedIdentity 和 https://aka.ms/RunCommandManaged |
RunCommandManagedIdentity |
outputBlobUri | 指定要在其中上传脚本输出流的 Azure 存储 Blob。 使用具有读取、追加、创建、写入访问权限的 SAS URI,或使用托管标识为 VM 提供对 Blob 的访问权限。 请参阅 outputBlobManagedIdentity 参数。 | 字符串 |
parameters | 脚本使用的参数。 | RunCommandInputParameter[] |
protectedParameters | 脚本使用的参数。 | RunCommandInputParameter[] |
runAsPassword | 指定执行 run 命令时 VM 上的用户帐户密码。 | 字符串 |
runAsUser | 指定执行 run 命令时 VM 上的用户帐户。 | string |
source | 运行命令脚本的源。 | VirtualMachineRunCommandScriptSource |
timeoutInSeconds | 执行 run 命令的超时时间(秒)。 | int |
treatFailureAsDeploymentFailure | 可选。 如果设置为 true,脚本中的任何失败都将使部署失败,ProvisioningState 将标记为“失败”。 如果设置为 false,ProvisioningState 将仅反映 run 命令是否由扩展平台运行,它不会指示脚本在脚本失败时是否失败。 如果脚本失败,请参阅 run 命令的实例视图,以查看 executionMessage、输出、错误: https://aka.ms/runcommandmanaged#get-execution-status-and-results |
bool |
RunCommandManagedIdentity
名称 | 说明 | 值 |
---|---|---|
clientId | 客户端 ID (用户分配的托管标识的 GUID 值) 。 如果提供了 ObjectId,则不应使用 ObjectId。 | 字符串 |
objectId | 对象 ID (用户分配的托管标识) GUID 值。 如果已提供,则不应使用 ClientId。 | 字符串 |
RunCommandInputParameter
名称 | 说明 | 值 |
---|---|---|
name | 运行命令参数名称。 | 字符串 (必需) |
value | 运行命令参数值。 | 字符串 (必需) |
VirtualMachineRunCommandScriptSource
名称 | 说明 | 值 |
---|---|---|
commandId | 指定预定义内置脚本的 commandId。 | string |
脚本 | 指定要在 VM 上执行的脚本内容。 | 字符串 |
scriptUri | 指定脚本下载位置。 它可以是具有读取访问权限的 Azure 存储 Blob 的 SAS URI,也可以是公共 URI。 | 字符串 |
scriptUriManagedIdentity | 用户分配的托管标识,在 Azure 存储 Blob 中有权访问 scriptUri。 对于系统分配的标识,请使用空对象。 确保 Azure 存储 Blob 存在,并且已向托管标识授予对 Blob 容器的访问权限,并分配了“存储 Blob 数据读取者”角色。 对于用户分配的标识,请确保将其添加到 VM 的标识下。 有关托管标识和运行命令的详细信息,请参阅 https://aka.ms/ManagedIdentity 和 https://aka.ms/RunCommandManaged. |
RunCommandManagedIdentity |
Terraform (AzAPI 提供程序) 资源定义
可以使用面向以下操作部署 virtualMachineScaleSets/virtualMachines/runCommands 资源类型:
- 资源组
有关每个 API 版本中已更改属性的列表,请参阅 更改日志。
资源格式
若要创建 Microsoft.Compute/virtualMachineScaleSets/virtualMachines/runCommands 资源,请将以下 Terraform 添加到模板。
resource "azapi_resource" "symbolicname" {
type = "Microsoft.Compute/virtualMachineScaleSets/virtualMachines/runCommands@2023-03-01"
name = "string"
location = "string"
parent_id = "string"
tags = {
tagName1 = "tagValue1"
tagName2 = "tagValue2"
}
body = jsonencode({
properties = {
asyncExecution = bool
errorBlobManagedIdentity = {
clientId = "string"
objectId = "string"
}
errorBlobUri = "string"
outputBlobManagedIdentity = {
clientId = "string"
objectId = "string"
}
outputBlobUri = "string"
parameters = [
{
name = "string"
value = "string"
}
]
protectedParameters = [
{
name = "string"
value = "string"
}
]
runAsPassword = "string"
runAsUser = "string"
source = {
commandId = "string"
script = "string"
scriptUri = "string"
scriptUriManagedIdentity = {
clientId = "string"
objectId = "string"
}
}
timeoutInSeconds = int
treatFailureAsDeploymentFailure = bool
}
})
}
属性值
virtualMachineScaleSets/virtualMachines/runCommands
名称 | 说明 | Value |
---|---|---|
type | 资源类型 | “Microsoft.Compute/virtualMachineScaleSets/virtualMachines/runCommands@2023-03-01” |
name | 资源名称 | 字符串 (必需) |
location | 资源位置 | 字符串 (必需) |
parent_id | 此资源的父资源的 ID。 | 类型为 的资源的 ID: virtualMachines |
标记 | 资源标记 | 标记名称和值的字典。 |
properties | 描述虚拟机运行命令的属性。 | VirtualMachineRunCommandProperties |
VirtualMachineRunCommandProperties
名称 | 说明 | 值 |
---|---|---|
asyncExecution | 可选。 如果设置为 true,则脚本启动后,预配将立即完成,并且不会等待脚本完成。 | bool |
errorBlobManagedIdentity | 有权访问 errorBlobUri 存储 Blob 的用户分配的托管标识。 对于系统分配的标识,请使用空对象。 确保已向托管标识授予对 Blob 容器的访问权限,并分配了“存储 Blob 数据参与者”角色。 对于用户分配的标识,请确保将其添加到 VM 的标识下。 有关托管标识和运行命令的详细信息,请参阅 https://aka.ms/ManagedIdentity 和 https://aka.ms/RunCommandManaged |
RunCommandManagedIdentity |
errorBlobUri | 指定要在其中上传脚本错误流的 Azure 存储 Blob。 使用具有读取、追加、创建、写入访问权限的 SAS URI,或使用托管标识为 VM 提供对 Blob 的访问权限。 请参阅 errorBlobManagedIdentity 参数。 | 字符串 |
outputBlobManagedIdentity | 有权访问 outputBlobUri 存储 Blob 的用户分配的托管标识。 对于系统分配的标识,请使用空对象。 确保已向托管标识授予对 Blob 容器的访问权限,并分配了“存储 Blob 数据参与者”角色。 对于用户分配的标识,请确保将其添加到 VM 的标识下。 有关托管标识和运行命令的详细信息,请参阅 https://aka.ms/ManagedIdentity 和 https://aka.ms/RunCommandManaged |
RunCommandManagedIdentity |
outputBlobUri | 指定要在其中上传脚本输出流的 Azure 存储 Blob。 使用具有读取、追加、创建、写入访问权限的 SAS URI,或使用托管标识为 VM 提供对 Blob 的访问权限。 请参阅 outputBlobManagedIdentity 参数。 | 字符串 |
parameters | 脚本使用的参数。 | RunCommandInputParameter[] |
protectedParameters | 脚本使用的参数。 | RunCommandInputParameter[] |
runAsPassword | 指定执行 run 命令时 VM 上的用户帐户密码。 | 字符串 |
runAsUser | 指定执行 run 命令时 VM 上的用户帐户。 | string |
source | 运行命令脚本的源。 | VirtualMachineRunCommandScriptSource |
timeoutInSeconds | 执行 run 命令的超时时间(秒)。 | int |
treatFailureAsDeploymentFailure | 可选。 如果设置为 true,脚本中的任何失败都将使部署失败,ProvisioningState 将标记为“失败”。 如果设置为 false,ProvisioningState 将仅反映 run 命令是否由扩展平台运行,它不会指示脚本在脚本失败时是否失败。 如果脚本失败,请参阅 run 命令的实例视图,以查看 executionMessage、输出、错误: https://aka.ms/runcommandmanaged#get-execution-status-and-results |
bool |
RunCommandManagedIdentity
名称 | 说明 | 值 |
---|---|---|
clientId | 客户端 ID (用户分配的托管标识的 GUID 值) 。 如果提供了 ObjectId,则不应使用 ObjectId。 | 字符串 |
objectId | 对象 ID (用户分配的托管标识) GUID 值。 如果已提供,则不应使用 ClientId。 | 字符串 |
RunCommandInputParameter
名称 | 说明 | 值 |
---|---|---|
name | 运行命令参数名称。 | 字符串 (必需) |
value | 运行命令参数值。 | 字符串 (必需) |
VirtualMachineRunCommandScriptSource
名称 | 说明 | 值 |
---|---|---|
commandId | 指定预定义内置脚本的 commandId。 | string |
脚本 | 指定要在 VM 上执行的脚本内容。 | 字符串 |
scriptUri | 指定脚本下载位置。 它可以是具有读取访问权限的 Azure 存储 Blob 的 SAS URI,也可以是公共 URI。 | 字符串 |
scriptUriManagedIdentity | 用户分配的托管标识,在 Azure 存储 Blob 中有权访问 scriptUri。 对于系统分配的标识,请使用空对象。 确保 Azure 存储 Blob 存在,并且已向托管标识授予对 Blob 容器的访问权限,并分配了“存储 Blob 数据读取者”角色。 对于用户分配的标识,请确保将其添加到 VM 的标识下。 有关托管标识和运行命令的详细信息,请参阅 https://aka.ms/ManagedIdentity 和 https://aka.ms/RunCommandManaged. |
RunCommandManagedIdentity |
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈