Share via


Microsoft.HybridCompute machines/runCommands

Bicep resource definition

The machines/runCommands resource type can be deployed with operations that target:

For a list of changed properties in each API version, see change log.

Resource format

To create a Microsoft.HybridCompute/machines/runCommands resource, add the following Bicep to your template.

resource symbolicname 'Microsoft.HybridCompute/machines/runCommands@2025-09-16-preview' = {
  parent: resourceSymbolicName
  location: 'string'
  name: 'string'
  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
  }
  tags: {
    {customized property}: 'string'
  }
}

Property Values

Microsoft.HybridCompute/machines/runCommands

Name Description Value
location The geo-location where the resource lives string (required)
name The resource name string

Constraints:
Pattern = [a-zA-Z0-9-_\.]+ (required)
parent In Bicep, you can specify the parent resource for a child resource. You only need to add this property when the child resource is declared outside of the parent resource.

For more information, see Child resource outside parent resource.
Symbolic name for resource of type: machines
properties Describes Run Command Properties MachineRunCommandProperties
tags Resource tags Dictionary of tag names and values. See Tags in templates

MachineRunCommandProperties

Name Description Value
asyncExecution Optional. If set to true, provisioning will complete as soon as script starts and will not wait for script to complete. bool
errorBlobManagedIdentity User-assigned managed identity that has access to errorBlobUri storage blob. Use an empty object in case of system-assigned identity. Make sure managed identity has been given access to blob's container with 'Storage Blob Data Contributor' role assignment. In case of user-assigned identity, make sure you add it under VM's identity. For more info on managed identity and Run Command, refer https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged RunCommandManagedIdentity
errorBlobUri Specifies the Azure storage blob where script error stream will be uploaded. Use a SAS URI with read, append, create, write access OR use managed identity to provide the VM access to the blob. Refer errorBlobManagedIdentity parameter. string
outputBlobManagedIdentity User-assigned managed identity that has access to outputBlobUri storage blob. Use an empty object in case of system-assigned identity. Make sure managed identity has been given access to blob's container with 'Storage Blob Data Contributor' role assignment. In case of user-assigned identity, make sure you add it under VM's identity. For more info on managed identity and Run Command, refer https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged RunCommandManagedIdentity
outputBlobUri Specifies the Azure storage blob where script output stream will be uploaded. Use a SAS URI with read, append, create, write access OR use managed identity to provide the VM access to the blob. Refer outputBlobManagedIdentity parameter. string
parameters The parameters used by the script. RunCommandInputParameter[]
protectedParameters The parameters used by the script. RunCommandInputParameter[]
runAsPassword Specifies the user account password on the machine when executing the run command. string

Constraints:
Sensitive value. Pass in as a secure parameter.
runAsUser Specifies the user account on the machine when executing the run command. string
source The source of the run command script. MachineRunCommandScriptSource
timeoutInSeconds The timeout in seconds to execute the run command. int

MachineRunCommandScriptSource

Name Description Value
commandId Specifies the commandId of predefined built-in script. string
script Specifies the script content to be executed on the machine. string
scriptUri Specifies the script download location. It can be either SAS URI of an Azure storage blob with read access or public URI. string
scriptUriManagedIdentity User-assigned managed identity that has access to scriptUri in case of Azure storage blob. Use an empty object in case of system-assigned identity. Make sure the Azure storage blob exists, and managed identity has been given access to blob's container with 'Storage Blob Data Reader' role assignment. In case of user-assigned identity, make sure you add it under VM's identity. For more info on managed identity and Run Command, refer https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged. RunCommandManagedIdentity

RunCommandInputParameter

Name Description Value
name The run command parameter name. string (required)
value The run command parameter value. string (required)

RunCommandManagedIdentity

Name Description Value
clientId Client Id (GUID value) of the user-assigned managed identity. ObjectId should not be used if this is provided. string
objectId Object Id (GUID value) of the user-assigned managed identity. ClientId should not be used if this is provided. string

TrackedResourceTags

Name Description Value

ARM template resource definition

The machines/runCommands resource type can be deployed with operations that target:

For a list of changed properties in each API version, see change log.

Resource format

To create a Microsoft.HybridCompute/machines/runCommands resource, add the following JSON to your template.

{
  "type": "Microsoft.HybridCompute/machines/runCommands",
  "apiVersion": "2025-09-16-preview",
  "name": "string",
  "location": "string",
  "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"
  },
  "tags": {
    "{customized property}": "string"
  }
}

Property Values

Microsoft.HybridCompute/machines/runCommands

Name Description Value
apiVersion The api version '2025-09-16-preview'
location The geo-location where the resource lives string (required)
name The resource name string

Constraints:
Pattern = [a-zA-Z0-9-_\.]+ (required)
properties Describes Run Command Properties MachineRunCommandProperties
tags Resource tags Dictionary of tag names and values. See Tags in templates
type The resource type 'Microsoft.HybridCompute/machines/runCommands'

MachineRunCommandProperties

Name Description Value
asyncExecution Optional. If set to true, provisioning will complete as soon as script starts and will not wait for script to complete. bool
errorBlobManagedIdentity User-assigned managed identity that has access to errorBlobUri storage blob. Use an empty object in case of system-assigned identity. Make sure managed identity has been given access to blob's container with 'Storage Blob Data Contributor' role assignment. In case of user-assigned identity, make sure you add it under VM's identity. For more info on managed identity and Run Command, refer https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged RunCommandManagedIdentity
errorBlobUri Specifies the Azure storage blob where script error stream will be uploaded. Use a SAS URI with read, append, create, write access OR use managed identity to provide the VM access to the blob. Refer errorBlobManagedIdentity parameter. string
outputBlobManagedIdentity User-assigned managed identity that has access to outputBlobUri storage blob. Use an empty object in case of system-assigned identity. Make sure managed identity has been given access to blob's container with 'Storage Blob Data Contributor' role assignment. In case of user-assigned identity, make sure you add it under VM's identity. For more info on managed identity and Run Command, refer https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged RunCommandManagedIdentity
outputBlobUri Specifies the Azure storage blob where script output stream will be uploaded. Use a SAS URI with read, append, create, write access OR use managed identity to provide the VM access to the blob. Refer outputBlobManagedIdentity parameter. string
parameters The parameters used by the script. RunCommandInputParameter[]
protectedParameters The parameters used by the script. RunCommandInputParameter[]
runAsPassword Specifies the user account password on the machine when executing the run command. string

Constraints:
Sensitive value. Pass in as a secure parameter.
runAsUser Specifies the user account on the machine when executing the run command. string
source The source of the run command script. MachineRunCommandScriptSource
timeoutInSeconds The timeout in seconds to execute the run command. int

MachineRunCommandScriptSource

Name Description Value
commandId Specifies the commandId of predefined built-in script. string
script Specifies the script content to be executed on the machine. string
scriptUri Specifies the script download location. It can be either SAS URI of an Azure storage blob with read access or public URI. string
scriptUriManagedIdentity User-assigned managed identity that has access to scriptUri in case of Azure storage blob. Use an empty object in case of system-assigned identity. Make sure the Azure storage blob exists, and managed identity has been given access to blob's container with 'Storage Blob Data Reader' role assignment. In case of user-assigned identity, make sure you add it under VM's identity. For more info on managed identity and Run Command, refer https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged. RunCommandManagedIdentity

RunCommandInputParameter

Name Description Value
name The run command parameter name. string (required)
value The run command parameter value. string (required)

RunCommandManagedIdentity

Name Description Value
clientId Client Id (GUID value) of the user-assigned managed identity. ObjectId should not be used if this is provided. string
objectId Object Id (GUID value) of the user-assigned managed identity. ClientId should not be used if this is provided. string

TrackedResourceTags

Name Description Value

Usage Examples

Terraform (AzAPI provider) resource definition

The machines/runCommands resource type can be deployed with operations that target:

For a list of changed properties in each API version, see change log.

Resource format

To create a Microsoft.HybridCompute/machines/runCommands resource, add the following Terraform to your template.

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.HybridCompute/machines/runCommands@2025-09-16-preview"
  name = "string"
  parent_id = "string"
  location = "string"
  tags = {
    {customized property} = "string"
  }
  body = {
    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
    }
  }
}

Property Values

Microsoft.HybridCompute/machines/runCommands

Name Description Value
location The geo-location where the resource lives string (required)
name The resource name string

Constraints:
Pattern = [a-zA-Z0-9-_\.]+ (required)
parent_id The ID of the resource that is the parent for this resource. ID for resource of type: machines
properties Describes Run Command Properties MachineRunCommandProperties
tags Resource tags Dictionary of tag names and values.
type The resource type "Microsoft.HybridCompute/machines/runCommands@2025-09-16-preview"

MachineRunCommandProperties

Name Description Value
asyncExecution Optional. If set to true, provisioning will complete as soon as script starts and will not wait for script to complete. bool
errorBlobManagedIdentity User-assigned managed identity that has access to errorBlobUri storage blob. Use an empty object in case of system-assigned identity. Make sure managed identity has been given access to blob's container with 'Storage Blob Data Contributor' role assignment. In case of user-assigned identity, make sure you add it under VM's identity. For more info on managed identity and Run Command, refer https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged RunCommandManagedIdentity
errorBlobUri Specifies the Azure storage blob where script error stream will be uploaded. Use a SAS URI with read, append, create, write access OR use managed identity to provide the VM access to the blob. Refer errorBlobManagedIdentity parameter. string
outputBlobManagedIdentity User-assigned managed identity that has access to outputBlobUri storage blob. Use an empty object in case of system-assigned identity. Make sure managed identity has been given access to blob's container with 'Storage Blob Data Contributor' role assignment. In case of user-assigned identity, make sure you add it under VM's identity. For more info on managed identity and Run Command, refer https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged RunCommandManagedIdentity
outputBlobUri Specifies the Azure storage blob where script output stream will be uploaded. Use a SAS URI with read, append, create, write access OR use managed identity to provide the VM access to the blob. Refer outputBlobManagedIdentity parameter. string
parameters The parameters used by the script. RunCommandInputParameter[]
protectedParameters The parameters used by the script. RunCommandInputParameter[]
runAsPassword Specifies the user account password on the machine when executing the run command. string

Constraints:
Sensitive value. Pass in as a secure parameter.
runAsUser Specifies the user account on the machine when executing the run command. string
source The source of the run command script. MachineRunCommandScriptSource
timeoutInSeconds The timeout in seconds to execute the run command. int

MachineRunCommandScriptSource

Name Description Value
commandId Specifies the commandId of predefined built-in script. string
script Specifies the script content to be executed on the machine. string
scriptUri Specifies the script download location. It can be either SAS URI of an Azure storage blob with read access or public URI. string
scriptUriManagedIdentity User-assigned managed identity that has access to scriptUri in case of Azure storage blob. Use an empty object in case of system-assigned identity. Make sure the Azure storage blob exists, and managed identity has been given access to blob's container with 'Storage Blob Data Reader' role assignment. In case of user-assigned identity, make sure you add it under VM's identity. For more info on managed identity and Run Command, refer https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged. RunCommandManagedIdentity

RunCommandInputParameter

Name Description Value
name The run command parameter name. string (required)
value The run command parameter value. string (required)

RunCommandManagedIdentity

Name Description Value
clientId Client Id (GUID value) of the user-assigned managed identity. ObjectId should not be used if this is provided. string
objectId Object Id (GUID value) of the user-assigned managed identity. ClientId should not be used if this is provided. string

TrackedResourceTags

Name Description Value