Azure Virtual Machines Virtual Machine Scale Set VM Run Commands API

The VirtualMachineScaleSetVMRunCommands API from Azure Virtual Machines — 2 operation(s) for virtualmachinescalesetvmruncommands.

GitHub OpenAPI

Operations 5

GET /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands Virtual machine scale set VM run commands list #
GET /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName} Virtual machine scale set VM run commands get #
PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName} Virtual machine scale set VM run commands create or update #
PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName} Virtual machine scale set VM run commands update #
DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName} Virtual machine scale set VM run commands delete #

Documentation

Specifications

SDKs

Schemas & Data

Other Resources

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/microsoft-azure-virtual-machines:microsoft-azure-virtual-machines-virtualmachinescalesetvmruncommands-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

microsoft-azure-virtual-machines-virtualmachinescalesetvmruncommands-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Azure Compute resource management API.
  version: '2026-04-01'
  description: Compute Client
  x-typespec-generated:
  - emitter: '@azure-tools/typespec-autorest'
servers:
- url: https://management.azure.com
security:
- azure_auth:
  - user_impersonation
tags:
- name: VirtualMachineScaleSetVMRunCommands
paths:
  ? /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands
  : get:
      operationId: VirtualMachineScaleSetVMRunCommands_List
      tags:
      - VirtualMachineScaleSetVMRunCommands
      description: The operation to get all run commands of an instance in Virtual Machine Scaleset.
      parameters:
      - $ref: '#/components/parameters/ApiVersionParameter'
      - $ref: '#/components/parameters/SubscriptionIdParameter'
      - $ref: '#/components/parameters/ResourceGroupNameParameter'
      - name: vmScaleSetName
        in: path
        description: The name of the VirtualMachineScaleSet
        required: true
        schema:
          type: string
      - name: instanceId
        in: path
        description: The name of the VirtualMachineScaleSetVM
        required: true
        schema:
          type: string
      - name: $expand
        in: query
        description: The expand expression to apply on the operation.
        required: false
        schema:
          type: string
      responses:
        '200':
          description: The request has succeeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VirtualMachineRunCommandsListResult'
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CloudError'
      x-ms-pageable:
        nextLinkName: nextLink
      summary: Virtual machine scale set VM run commands list
      x-summary-source: derived
  ? /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}
  : get:
      operationId: VirtualMachineScaleSetVMRunCommands_Get
      tags:
      - VirtualMachineScaleSetVMRunCommands
      description: The operation to get the VMSS VM run command.
      parameters:
      - $ref: '#/components/parameters/ApiVersionParameter'
      - $ref: '#/components/parameters/SubscriptionIdParameter'
      - $ref: '#/components/parameters/ResourceGroupNameParameter'
      - name: vmScaleSetName
        in: path
        description: The name of the VirtualMachineScaleSet
        required: true
        schema:
          type: string
      - name: instanceId
        in: path
        description: The name of the VirtualMachineScaleSetVM
        required: true
        schema:
          type: string
      - name: runCommandName
        in: path
        description: The name of the VirtualMachineRunCommand
        required: true
        schema:
          type: string
      - name: $expand
        in: query
        description: The expand expression to apply on the operation.
        required: false
        schema:
          type: string
      responses:
        '200':
          description: Azure operation completed successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VirtualMachineRunCommand'
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CloudError'
      summary: Virtual machine scale set VM run commands get
      x-summary-source: derived
    put:
      operationId: VirtualMachineScaleSetVMRunCommands_CreateOrUpdate
      tags:
      - VirtualMachineScaleSetVMRunCommands
      description: The operation to create or update the VMSS VM run command.
      parameters:
      - $ref: '#/components/parameters/ApiVersionParameter'
      - $ref: '#/components/parameters/SubscriptionIdParameter'
      - $ref: '#/components/parameters/ResourceGroupNameParameter'
      - name: vmScaleSetName
        in: path
        description: The name of the VirtualMachineScaleSet
        required: true
        schema:
          type: string
      - name: instanceId
        in: path
        description: The name of the VirtualMachineScaleSetVM
        required: true
        schema:
          type: string
      - name: runCommandName
        in: path
        description: The name of the VirtualMachineRunCommand
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Resource 'VirtualMachineRunCommand' update operation succeeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VirtualMachineRunCommand'
        '201':
          description: Resource 'VirtualMachineRunCommand' create operation succeeded
          headers:
            Location:
              description: The Location header contains the URL where the status of the long running operation can be checked.
              schema:
                type: string
            Retry-After:
              description: The Retry-After header can indicate how long the client should wait before polling the operation status.
              schema:
                type: integer
                format: int32
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VirtualMachineRunCommand'
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CloudError'
      x-ms-long-running-operation-options:
        final-state-via: location
        final-state-schema: '#/definitions/VirtualMachineRunCommand'
      x-ms-long-running-operation: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VirtualMachineRunCommand'
        description: Parameters supplied to the Create Virtual Machine RunCommand operation.
        required: true
      summary: Virtual machine scale set VM run commands create or update
      x-summary-source: derived
    patch:
      operationId: VirtualMachineScaleSetVMRunCommands_Update
      tags:
      - VirtualMachineScaleSetVMRunCommands
      description: The operation to update the VMSS VM run command.
      parameters:
      - $ref: '#/components/parameters/ApiVersionParameter'
      - $ref: '#/components/parameters/SubscriptionIdParameter'
      - $ref: '#/components/parameters/ResourceGroupNameParameter'
      - name: vmScaleSetName
        in: path
        description: The name of the VirtualMachineScaleSet
        required: true
        schema:
          type: string
      - name: instanceId
        in: path
        description: The name of the VirtualMachineScaleSetVM
        required: true
        schema:
          type: string
      - name: runCommandName
        in: path
        description: The name of the VirtualMachineRunCommand
        required: true
        schema:
          type: string
      responses:
        '200':
          description: The request has succeeded.
          headers:
            Location:
              description: The Location header contains the URL where the status of the long running operation can be checked.
              schema:
                type: string
            Retry-After:
              description: The Retry-After header can indicate how long the client should wait before polling the operation status.
              schema:
                type: integer
                format: int32
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VirtualMachineRunCommand'
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CloudError'
      x-ms-long-running-operation-options:
        final-state-via: location
        final-state-schema: '#/definitions/VirtualMachineRunCommand'
      x-ms-long-running-operation: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VirtualMachineRunCommandUpdate'
        description: Resource create parameters.
        required: true
      summary: Virtual machine scale set VM run commands update
      x-summary-source: derived
    delete:
      operationId: VirtualMachineScaleSetVMRunCommands_Delete
      tags:
      - VirtualMachineScaleSetVMRunCommands
      description: The operation to delete the VMSS VM run command.
      parameters:
      - $ref: '#/components/parameters/ApiVersionParameter'
      - $ref: '#/components/parameters/SubscriptionIdParameter'
      - $ref: '#/components/parameters/ResourceGroupNameParameter'
      - name: vmScaleSetName
        in: path
        description: The name of the VirtualMachineScaleSet
        required: true
        schema:
          type: string
      - name: instanceId
        in: path
        description: The name of the VirtualMachineScaleSetVM
        required: true
        schema:
          type: string
      - name: runCommandName
        in: path
        description: The name of the VirtualMachineRunCommand
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Resource deleted successfully.
        '202':
          description: Resource deletion accepted.
          headers:
            Location:
              description: The Location header contains the URL where the status of the long running operation can be checked.
              schema:
                type: string
            Retry-After:
              description: The Retry-After header can indicate how long the client should wait before polling the operation status.
              schema:
                type: integer
                format: int32
        '204':
          description: Resource does not exist.
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CloudError'
      x-ms-long-running-operation-options:
        final-state-via: location
      x-ms-long-running-operation: true
      summary: Virtual machine scale set VM run commands delete
      x-summary-source: derived
components:
  schemas:
    ApiError:
      type: object
      properties:
        details:
          type: array
          items:
            $ref: '#/components/schemas/ApiErrorBase'
          x-ms-identifiers:
          - message
          - target
          description: The Api error details
        innererror:
          $ref: '#/components/schemas/InnerError'
          description: The Api inner error
        code:
          type: string
          description: The error code.
        target:
          type: string
          description: The target of the particular error.
        message:
          type: string
          description: The error message.
      description: Api error.
    VirtualMachineRunCommandProperties:
      type: object
      description: Describes the properties of a Virtual Machine run command.
      properties:
        source:
          $ref: '#/components/schemas/VirtualMachineRunCommandScriptSource'
          description: The source of the run command script.
        parameters:
          type: array
          description: The parameters used by the script.
          items:
            $ref: '#/components/schemas/RunCommandInputParameter'
          x-ms-identifiers:
          - name
        protectedParameters:
          type: array
          description: The parameters used by the script.
          items:
            $ref: '#/components/schemas/RunCommandInputParameter'
          x-ms-identifiers:
          - name
        asyncExecution:
          type: boolean
          description: Optional. If set to true, provisioning will complete as soon as the script starts and will not wait for script to complete.
        runAsUser:
          type: string
          description: Specifies the user account on the VM when executing the run command.
        runAsPassword:
          type: string
          description: Specifies the user account password on the VM when executing the run command.
        timeoutInSeconds:
          type: integer
          format: int32
          description: The timeout in seconds to execute the run command.
        outputBlobUri:
          type: string
          description: 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.
        errorBlobUri:
          type: string
          description: 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.
        outputBlobManagedIdentity:
          $ref: '#/components/schemas/RunCommandManagedIdentity'
          description: 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
        errorBlobManagedIdentity:
          $ref: '#/components/schemas/RunCommandManagedIdentity'
          description: 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
        provisioningState:
          type: string
          description: 'The provisioning state, which only appears in the response. If treatFailureAsDeploymentFailure set to true, any failure in the script will fail the deployment and ProvisioningState will be marked as Failed. If treatFailureAsDeploymentFailure set to false, ProvisioningState would only reflect whether the run command was run or not by the extensions platform, it would not indicate whether script failed in case of script failures. See instance view of run command in case of script failures to see executionMessage, output, error: https://aka.ms/runcommandmanaged#get-execution-status-and-results'
          readOnly: true
        instanceView:
          $ref: '#/components/schemas/VirtualMachineRunCommandInstanceView'
          description: The virtual machine run command instance view.
          readOnly: true
        treatFailureAsDeploymentFailure:
          type: boolean
          description: 'Optional. If set to true, any failure in the script will fail the deployment and ProvisioningState will be marked as Failed. If set to false, ProvisioningState would only reflect whether the run command was run or not by the extensions platform, it would not indicate whether script failed in case of script failures. See instance view of run command in case of script failures to see executionMessage, output, error: https://aka.ms/runcommandmanaged#get-execution-status-and-results'
    VirtualMachineRunCommand:
      type: object
      description: Describes a Virtual Machine run command.
      properties:
        properties:
          $ref: '#/components/schemas/VirtualMachineRunCommandProperties'
          description: Describes the properties of a Virtual Machine run command.
          x-ms-client-flatten: true
      allOf:
      - $ref: '#/components/schemas/TrackedResource'
    RunCommandInputParameter:
      type: object
      description: Describes the properties of a run command parameter.
      properties:
        name:
          type: string
          description: The run command parameter name.
        value:
          type: string
          description: The run command parameter value.
      required:
      - name
      - value
    TrackedResource:
      type: object
      title: Tracked Resource
      description: The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'
      properties:
        tags:
          type: object
          description: Resource tags.
          additionalProperties:
            type: string
          x-ms-mutability:
          - read
          - create
          - update
        location:
          type: string
          description: The geo-location where the resource lives
          x-ms-mutability:
          - read
          - create
      required:
      - location
      allOf:
      - $ref: '#/components/schemas/Resource'
    ExecutionState:
      type: string
      description: Script execution status.
      enum:
      - Unknown
      - Pending
      - Running
      - Failed
      - Succeeded
      - TimedOut
      - Canceled
      x-ms-enum:
        name: ExecutionState
        modelAsString: true
        values:
        - name: Unknown
          value: Unknown
        - name: Pending
          value: Pending
        - name: Running
          value: Running
        - name: Failed
          value: Failed
        - name: Succeeded
          value: Succeeded
        - name: TimedOut
          value: TimedOut
        - name: Canceled
          value: Canceled
    InstanceViewStatus:
      type: object
      description: Instance view status.
      properties:
        code:
          type: string
          description: The status code.
        level:
          $ref: '#/components/schemas/StatusLevelTypes'
          description: The level code.
        displayStatus:
          type: string
          description: The short localizable label for the status.
        message:
          type: string
          description: The detailed status message, including for alerts and error messages.
        time:
          type: string
          format: date-time
          description: The time of the status.
    RunCommandManagedIdentity:
      type: object
      description: Contains clientId or objectId (use only one, not both) of a user-assigned managed identity that has access to storage blob used in Run Command. Use an empty RunCommandManagedIdentity object in case of system-assigned identity. Make sure the Azure storage blob exists in case of scriptUri, and managed identity has been given access to blob's container with 'Storage Blob Data Reader' role assignment with scriptUri blob and 'Storage Blob Data Contributor' for Append blobs(outputBlobUri, errorBlobUri). 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.
      properties:
        clientId:
          type: string
          description: Client Id (GUID value) of the user-assigned managed identity. ObjectId should not be used if this is provided.
        objectId:
          type: string
          description: Object Id (GUID value) of the user-assigned managed identity. ClientId should not be used if this is provided.
    StatusLevelTypes:
      type: string
      description: The level code.
      enum:
      - Info
      - Warning
      - Error
      x-ms-enum:
        name: StatusLevelTypes
        modelAsString: false
    VirtualMachineRunCommandInstanceView:
      type: object
      description: The instance view of a virtual machine run command.
      properties:
        executionState:
          $ref: '#/components/schemas/ExecutionState'
          description: Script execution status.
        executionMessage:
          type: string
          description: Communicate script configuration errors or execution messages.
        exitCode:
          type: integer
          format: int32
          description: Exit code returned from script execution.
        output:
          type: string
          description: Script output stream.
        error:
          type: string
          description: Script error stream.
        startTime:
          type: string
          format: date-time
          description: Script start time.
        endTime:
          type: string
          format: date-time
          description: Script end time.
        statuses:
          type: array
          description: The resource status information.
          items:
            $ref: '#/components/schemas/InstanceViewStatus'
          x-ms-identifiers: []
    VirtualMachineRunCommandScriptSource:
      type: object
      description: 'Describes the script sources for run command. Use only one of these script sources: script, scriptUri, commandId, galleryScriptReferenceId.'
      properties:
        script:
          type: string
          description: Specifies the script content to be executed on the VM.
        scriptUri:
          type: string
          description: Specifies the script download location. It can be either SAS URI of an Azure storage blob with read access or public URI.
        commandId:
          type: string
          description: Specifies a commandId of predefined built-in script. Command IDs available for Linux are listed at https://aka.ms/RunCommandManagedLinux#available-commands, Windows at https://aka.ms/RunCommandManagedWindows#available-commands.
        scriptUriManagedIdentity:
          $ref: '#/components/schemas/RunCommandManagedIdentity'
          description: 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.
        scriptShell:
          $ref: '#/components/schemas/ScriptShellTypes'
          description: Optional. Specify which shell to use for running the script. These values must match those expected by the extension. Currently supported only for Windows VMs, script uses Powershell 7 when specified. Powershell 7 must be already installed on the machine to use Powershell7 parameter value.
        galleryScriptReferenceId:
          type: string
          description: The resource ID of a Gallery Script version that needs to be executed. Example ID looks like /subscriptions/{subId}/resourceGroups/{rgName}/providers/Microsoft.Compute/galleries/{galleryName}/scripts/{scriptName}/versions/{version}.
    CloudError:
      type: object
      x-ms-external: true
      properties:
        error:
          $ref: '#/components/schemas/ApiError'
      description: An error response from the Compute service.
    VirtualMachineRunCommandsListResult:
      type: object
      description: The List run command operation response
      properties:
        value:
          type: array
          description: The list of run commands.
          items:
            $ref: '#/components/schemas/VirtualMachineRunCommand'
        nextLink:
          type: string
          format: uri
          description: The uri to fetch the next page of run commands.
      required:
      - value
    ScriptShellTypes:
      type: string
      description: Script shell types.
      enum:
      - Default
      - Powershell7
      x-ms-enum:
        name: ScriptShellTypes
        modelAsString: true
        values:
        - name: Default
          value: Default
          description: Default script shell type.
        - name: Powershell7
          value: Powershell7
          description: Powershell7 script shell type.
    VirtualMachineRunCommandUpdate:
      type: object
      description: Describes a Virtual Machine run command.
      properties:
        properties:
          $ref: '#/components/schemas/VirtualMachineRunCommandProperties'
          description: Describes the properties of a Virtual Machine run command.
          x-ms-client-flatten: true
      allOf:
      - $ref: '#/components/schemas/UpdateResource'
    UpdateResource:
      type: object
      description: The Update Resource model definition.
      properties:
        tags:
          type: object
          description: Resource tags
          additionalProperties:
            type: string
  parameters:
    SubscriptionIdParameter:
      name: subscriptionId
      in: path
      description: The ID of the target subscription.
      required: true
      schema:
        type: string
        minLength: 1
    ResourceGroupNameParameter:
      name: resourceGroupName
      in: path
      description: The name of the resource group. The name is case insensitive.
      required: true
      x-ms-parameter-location: method
      schema:
        type: string
        maxLength: 90
        minLength: 1
    ApiVersionParameter:
      name: api-version
      in: query
      description: The API version to use for this operation.
      required: true
      schema:
        type: string
        minLength: 1
  securitySchemes:
    azure_auth:
      type: oauth2
      flows:
        implicit:
          scopes:
            user_impersonation: impersonate your user account
          authorizationUrl: https://login.microsoftonline.com/common/oauth2/authorize
      description: Azure Active Directory OAuth2 Flow.
x-ms-paths:
  ? /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions?$expand=Properties
  : get:
      operationId: VirtualMachineImages_ListWithProperties
      tags:
      - VirtualMachineImages
      parameters:
      - $ref: '#/components/parameters/ApiVersionParameter'
      - $ref: '#/components/parameters/SubscriptionIdParameter'
      - $ref: '#/components/parameters/LocationParameter'
      - name: publisherName
        in: path
        description: A valid image publisher.
        required: true
        type: string
      - name: offer
        in: path
        description: A valid image publisher offer.
        required: true
        type: string
      - name: skus
        in: path
        description: A valid image SKU.
        required: true
        type: string
      - name: $expand
        in: query
        description: The expand expression to apply on the operation.
        required: true
        type: string
      - name: $top
        in: query
        required: false
        type: integer
        format: int32
      - name: $orderby
        in: query
        required: false
        type: string
      responses:
        '200':
          description: Azure operation completed successfully.
          schema:
            type: array
            items:
              $ref: '#/components/schemas/VirtualMachineImage'
        default:
          description: An unexpected error response.
          schema:
            $ref: '#/components/schemas/CloudError'