Microsoft.Compute virtualMachines/runCommands 2022-03-01

Bicep resource definition

The virtualMachines/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.Compute/virtualMachines/runCommands resource, add the following Bicep to your template.

resource symbolicname 'Microsoft.Compute/virtualMachines/runCommands@2022-03-01' = {
  name: 'string'
  location: 'string'
  tags: {
    tagName1: 'tagValue1'
    tagName2: 'tagValue2'
  }
  parent: resourceSymbolicName
  properties: {
    asyncExecution: bool
    errorBlobUri: 'string'
    outputBlobUri: 'string'
    parameters: [
      {
        name: 'string'
        value: 'string'
      }
    ]
    protectedParameters: [
      {
        name: 'string'
        value: 'string'
      }
    ]
    runAsPassword: 'string'
    runAsUser: 'string'
    source: {
      commandId: 'string'
      script: 'string'
      scriptUri: 'string'
    }
    timeoutInSeconds: int
  }
}

Property values

virtualMachines/runCommands

Name Description Value
name The resource name

See how to set names and types for child resources in Bicep.
string (required)
location Resource location string (required)
tags Resource tags Dictionary of tag names and values. See Tags in templates
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: virtualMachines
properties Describes the properties of a Virtual Machine run command. VirtualMachineRunCommandProperties

VirtualMachineRunCommandProperties

Name Description Value
asyncExecution Optional. If set to true, provisioning will complete as soon as the script starts and will not wait for script to complete. bool
errorBlobUri Specifies the Azure storage blob where script error stream will be uploaded. string
outputBlobUri Specifies the Azure storage blob where script output stream will be uploaded. 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 VM when executing the run command. string
runAsUser Specifies the user account on the VM when executing the run command. string
source The source of the run command script. VirtualMachineRunCommandScriptSource
timeoutInSeconds The timeout in seconds to execute the run command. int

RunCommandInputParameter

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

VirtualMachineRunCommandScriptSource

Name Description Value
commandId Specifies a commandId of predefined built-in script. string
script Specifies the script content to be executed on the VM. string
scriptUri Specifies the script download location. string

Quickstart templates

The following quickstart templates deploy this resource type.

Template Description
SharePoint Subscription / 2019 / 2016 / 2013 all configured

Deploy to Azure
This template creates a SharePoint Subscription / 2019 / 2016 / 2013 farm with an extensive configuration that would take ages to perform manually, including a federated authentication with ADFS, an OAuth trust, the User Profiles service and a web application with 2 zones that contains multiple path based and host-named site collections. On the SharePoint virtual machines, Chocolatey is used to install the latest version of Notepad++, Visual Studio Code, Azure Data Studio, Fiddler, ULS Viewer and 7-Zip.

ARM template resource definition

The virtualMachines/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.Compute/virtualMachines/runCommands resource, add the following JSON to your template.

{
  "type": "Microsoft.Compute/virtualMachines/runCommands",
  "apiVersion": "2022-03-01",
  "name": "string",
  "location": "string",
  "tags": {
    "tagName1": "tagValue1",
    "tagName2": "tagValue2"
  },
  "properties": {
    "asyncExecution": "bool",
    "errorBlobUri": "string",
    "outputBlobUri": "string",
    "parameters": [
      {
        "name": "string",
        "value": "string"
      }
    ],
    "protectedParameters": [
      {
        "name": "string",
        "value": "string"
      }
    ],
    "runAsPassword": "string",
    "runAsUser": "string",
    "source": {
      "commandId": "string",
      "script": "string",
      "scriptUri": "string"
    },
    "timeoutInSeconds": "int"
  }
}

Property values

virtualMachines/runCommands

Name Description Value
type The resource type 'Microsoft.Compute/virtualMachines/runCommands'
apiVersion The resource api version '2022-03-01'
name The resource name

See how to set names and types for child resources in JSON ARM templates.
string (required)
location Resource location string (required)
tags Resource tags Dictionary of tag names and values. See Tags in templates
properties Describes the properties of a Virtual Machine run command. VirtualMachineRunCommandProperties

VirtualMachineRunCommandProperties

Name Description Value
asyncExecution Optional. If set to true, provisioning will complete as soon as the script starts and will not wait for script to complete. bool
errorBlobUri Specifies the Azure storage blob where script error stream will be uploaded. string
outputBlobUri Specifies the Azure storage blob where script output stream will be uploaded. 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 VM when executing the run command. string
runAsUser Specifies the user account on the VM when executing the run command. string
source The source of the run command script. VirtualMachineRunCommandScriptSource
timeoutInSeconds The timeout in seconds to execute the run command. int

RunCommandInputParameter

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

VirtualMachineRunCommandScriptSource

Name Description Value
commandId Specifies a commandId of predefined built-in script. string
script Specifies the script content to be executed on the VM. string
scriptUri Specifies the script download location. string

Quickstart templates

The following quickstart templates deploy this resource type.

Template Description
SharePoint Subscription / 2019 / 2016 / 2013 all configured

Deploy to Azure
This template creates a SharePoint Subscription / 2019 / 2016 / 2013 farm with an extensive configuration that would take ages to perform manually, including a federated authentication with ADFS, an OAuth trust, the User Profiles service and a web application with 2 zones that contains multiple path based and host-named site collections. On the SharePoint virtual machines, Chocolatey is used to install the latest version of Notepad++, Visual Studio Code, Azure Data Studio, Fiddler, ULS Viewer and 7-Zip.

Terraform (AzAPI provider) resource definition

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

  • Resource groups

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

Resource format

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

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.Compute/virtualMachines/runCommands@2022-03-01"
  name = "string"
  location = "string"
  parent_id = "string"
  tags = {
    tagName1 = "tagValue1"
    tagName2 = "tagValue2"
  }
  body = jsonencode({
    properties = {
      asyncExecution = bool
      errorBlobUri = "string"
      outputBlobUri = "string"
      parameters = [
        {
          name = "string"
          value = "string"
        }
      ]
      protectedParameters = [
        {
          name = "string"
          value = "string"
        }
      ]
      runAsPassword = "string"
      runAsUser = "string"
      source = {
        commandId = "string"
        script = "string"
        scriptUri = "string"
      }
      timeoutInSeconds = int
    }
  })
}

Property values

virtualMachines/runCommands

Name Description Value
type The resource type "Microsoft.Compute/virtualMachines/runCommands@2022-03-01"
name The resource name string (required)
location Resource location string (required)
parent_id The ID of the resource that is the parent for this resource. ID for resource of type: virtualMachines
tags Resource tags Dictionary of tag names and values.
properties Describes the properties of a Virtual Machine run command. VirtualMachineRunCommandProperties

VirtualMachineRunCommandProperties

Name Description Value
asyncExecution Optional. If set to true, provisioning will complete as soon as the script starts and will not wait for script to complete. bool
errorBlobUri Specifies the Azure storage blob where script error stream will be uploaded. string
outputBlobUri Specifies the Azure storage blob where script output stream will be uploaded. 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 VM when executing the run command. string
runAsUser Specifies the user account on the VM when executing the run command. string
source The source of the run command script. VirtualMachineRunCommandScriptSource
timeoutInSeconds The timeout in seconds to execute the run command. int

RunCommandInputParameter

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

VirtualMachineRunCommandScriptSource

Name Description Value
commandId Specifies a commandId of predefined built-in script. string
script Specifies the script content to be executed on the VM. string
scriptUri Specifies the script download location. string