Virtual Machine Run Commands - List

Lists all available run commands for a subscription in a location.

GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands?api-version=2024-03-01

URI Parameters

Name In Required Type Description
location
path True

string

The location upon which run commands is queried.

Regex pattern: ^[-\w\._]+$

subscriptionId
path True

string

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

api-version
query True

string

Client Api Version.

Responses

Name Type Description
200 OK

RunCommandListResult

OK

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

VirtualMachineRunCommandList

Sample Request

GET https://management.azure.com/subscriptions/subid/providers/Microsoft.Compute/locations/SoutheastAsia/runCommands?api-version=2024-03-01

Sample Response

{
  "value": [
    {
      "$schema": "http://schema.management.azure.com/schemas/2016-11-17/runcommands.json",
      "id": "EnableRemotePS",
      "osType": "Windows",
      "label": "Enable remote PowerShell",
      "description": "Configure the machine to enable remote PowerShell."
    },
    {
      "$schema": "http://schema.management.azure.com/schemas/2016-11-17/runcommands.json",
      "id": "IPConfig",
      "osType": "Windows",
      "label": "List IP configuration",
      "description": "Shows detailed information for the IP address, subnet mask and default gateway for each adapter bound to TCP/IP."
    },
    {
      "$schema": "http://schema.management.azure.com/schemas/2016-11-17/runcommands.json",
      "id": "RunPowerShellScript",
      "osType": "Windows",
      "label": "Executes a PowerShell script",
      "description": "Custom multiline PowerShell script should be defined in script property. Optional parameters can be set in parameters property."
    },
    {
      "$schema": "http://schema.management.azure.com/schemas/2016-11-17/runcommands.json",
      "id": "RunShellScript",
      "osType": "Linux",
      "label": "Executes a Linux shell script",
      "description": "Custom multiline shell script should be defined in script property. Optional parameters can be set in parameters property."
    },
    {
      "$schema": "http://schema.management.azure.com/schemas/2016-11-17/runcommands.json",
      "id": "ifconfig",
      "osType": "Linux",
      "label": "List network configuration",
      "description": "Get the configuration of all network interfaces."
    },
    {
      "$schema": "http://schema.management.azure.com/schemas/2016-11-17/runcommands.json",
      "id": "EnableAdminAccount",
      "osType": "Windows",
      "label": "Enable administrator account",
      "description": "Checks if the local Administrator account is disabled, and if so enables it."
    },
    {
      "$schema": "http://schema.management.azure.com/schemas/2016-11-17/runcommands.json",
      "id": "ResetAccountPassword",
      "osType": "Windows",
      "label": "Reset built-in Administrator account password",
      "description": "Reset built-in Administrator account password."
    },
    {
      "$schema": "http://schema.management.azure.com/schemas/2016-11-17/runcommands.json",
      "id": "RDPSettings",
      "osType": "Windows",
      "label": "Verify RDP Listener Settings",
      "description": "Checks registry settings and domain policy settings. Suggests policy actions if machine is part of a domain or modifies the settings to default values."
    },
    {
      "$schema": "http://schema.management.azure.com/schemas/2016-11-17/runcommands.json",
      "id": "SetRDPPort",
      "osType": "Windows",
      "label": "Set Remote Desktop port",
      "description": "Sets the default or user specified port number for Remote Desktop connections. Enables firewall rule for inbound access to the port."
    },
    {
      "$schema": "http://schema.management.azure.com/schemas/2016-11-17/runcommands.json",
      "id": "ResetRDPCert",
      "osType": "Windows",
      "label": "Restore RDP Authentication mode to defaults",
      "description": "Removes the SSL certificate tied to the RDP listener and restores the RDP listerner security to default. Use this script if you see any issues with the certificate."
    }
  ]
}

Definitions

Name Description
OperatingSystemTypes

The Operating System type.

RunCommandDocumentBase

Describes the properties of a Run Command metadata.

RunCommandListResult

The List Virtual Machine operation response.

OperatingSystemTypes

The Operating System type.

Name Type Description
Linux

string

Windows

string

RunCommandDocumentBase

Describes the properties of a Run Command metadata.

Name Type Description
$schema

string

The VM run command schema.

description

string

The VM run command description.

id

string

The VM run command id.

label

string

The VM run command label.

osType

OperatingSystemTypes

The Operating System type.

RunCommandListResult

The List Virtual Machine operation response.

Name Type Description
nextLink

string

The uri to fetch the next page of run commands. Call ListNext() with this to fetch the next page of run commands.

value

RunCommandDocumentBase[]

The list of virtual machine run commands.