Virtual Machine Scale Set VM Run Commands - Get

The operation to get the VMSS VM run command.

HTTP
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}?api-version=2021-07-01
HTTP
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}?$expand={$expand}&api-version=2021-07-01

URI Parameters

Name In Required Type Description
instanceId
path True

string

The instance ID of the virtual machine.

resourceGroupName
path True

string

The name of the resource group.

runCommandName
path True

string

The name of the virtual machine run command.

subscriptionId
path True

string

Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.

vmScaleSetName
path True

string

The name of the VM scale set.

api-version
query True

string

Client Api Version.

$expand
query

string

The expand expression to apply on the operation.

Responses

Name Type Description
200 OK

VirtualMachineRunCommand

OK

Media Types: "application/json", "text/json"

Other Status Codes

CloudError

Error response describing why the operation failed.

Media Types: "application/json", "text/json"

Security

azure_auth

Azure Active Directory OAuth2 Flow

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation impersonate your user account

Examples

Get VirtualMachineScaleSet VM run commands.

Sample request

HTTP
GET https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myvmScaleSet/virtualMachines/0/runCommands/myRunCommand?api-version=2021-07-01

Sample response

JSON
{
  "name": "myRunCommand",
  "type": "Microsoft.Compute/virtualMachineScaleSets/virtualMachines/runCommands",
  "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myvmScaleSet/virtualMachines/0/runCommands/myRunCommand",
  "location": "westus",
  "tags": {
    "tag1": "value1",
    "tag2": "value2"
  },
  "properties": {
    "source": {
      "script": "Write-Host Hello World!"
    },
    "parameters": [
      {
        "name": "param1",
        "value": "value1"
      },
      {
        "name": "param2",
        "value": "value2"
      }
    ],
    "asyncExecution": false,
    "runAsUser": "user1",
    "timeoutInSeconds": 3600,
    "provisioningState": "Succeeded"
  }
}

Definitions

Name Description
ApiError

Api error.

ApiErrorBase

Api error base.

CloudError

An error response from the Compute service.

ExecutionState

Script execution status.

InnerError

Inner error details.

InstanceViewStatus

Instance view status.

RunCommandInputParameter

Describes the properties of a run command parameter.

StatusLevelTypes

The level code.

VirtualMachineRunCommand

Describes a Virtual Machine run command.

VirtualMachineRunCommandInstanceView

The instance view of a virtual machine run command.

VirtualMachineRunCommandScriptSource

Describes the script sources for run command.

ApiError

Api error.

Name Type Description
code

string

The error code.

details

ApiErrorBase[]

The Api error details

innererror

InnerError

The Api inner error

message

string

The error message.

target

string

The target of the particular error.

ApiErrorBase

Api error base.

Name Type Description
code

string

The error code.

message

string

The error message.

target

string

The target of the particular error.

CloudError

An error response from the Compute service.

Name Type Description
error

ApiError

Api error.

ExecutionState

Script execution status.

Value Description
Canceled
Failed
Pending
Running
Succeeded
TimedOut
Unknown

InnerError

Inner error details.

Name Type Description
errordetail

string

The internal error message or exception dump.

exceptiontype

string

The exception type.

InstanceViewStatus

Instance view status.

Name Type Description
code

string

The status code.

displayStatus

string

The short localizable label for the status.

level

StatusLevelTypes

The level code.

message

string

The detailed status message, including for alerts and error messages.

time

string

The time of the status.

RunCommandInputParameter

Describes the properties of a run command parameter.

Name Type Description
name

string

The run command parameter name.

value

string

The run command parameter value.

StatusLevelTypes

The level code.

Value Description
Error
Info
Warning

VirtualMachineRunCommand

Describes a Virtual Machine run command.

Name Type Default value Description
id

string

Resource Id

location

string

Resource location

name

string

Resource name

properties.asyncExecution

boolean

False

Optional. If set to true, provisioning will complete as soon as the script starts and will not wait for script to complete.

properties.errorBlobUri

string

Specifies the Azure storage blob where script error stream will be uploaded.

properties.instanceView

VirtualMachineRunCommandInstanceView

The virtual machine run command instance view.

properties.outputBlobUri

string

Specifies the Azure storage blob where script output stream will be uploaded.

properties.parameters

RunCommandInputParameter[]

The parameters used by the script.

properties.protectedParameters

RunCommandInputParameter[]

The parameters used by the script.

properties.provisioningState

string

The provisioning state, which only appears in the response.

properties.runAsPassword

string

Specifies the user account password on the VM when executing the run command.

properties.runAsUser

string

Specifies the user account on the VM when executing the run command.

properties.source

VirtualMachineRunCommandScriptSource

The source of the run command script.

properties.timeoutInSeconds

integer

The timeout in seconds to execute the run command.

tags

object

Resource tags

type

string

Resource type

VirtualMachineRunCommandInstanceView

The instance view of a virtual machine run command.

Name Type Description
endTime

string

Script end time.

error

string

Script error stream.

executionMessage

string

Communicate script configuration errors or execution messages.

executionState

ExecutionState

Script execution status.

exitCode

integer

Exit code returned from script execution.

output

string

Script output stream.

startTime

string

Script start time.

statuses

InstanceViewStatus[]

The resource status information.

VirtualMachineRunCommandScriptSource

Describes the script sources for run command.

Name Type Description
commandId

string

Specifies a commandId of predefined built-in script.

script

string

Specifies the script content to be executed on the VM.

scriptUri

string

Specifies the script download location.