你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Virtual Machine Run Commands - List

Lists某个位置中订阅的所有可用运行命令。

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

URI 参数

名称 必需 类型 说明
location
path True

string

查询运行命令的位置。

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

subscriptionId
path True

string

唯一标识 Microsoft Azure 订阅的订阅凭据。 此订阅 ID 是每个服务调用的 URI 的一部分。

api-version
query True

string

客户端 API 版本。

响应

名称 类型 说明
200 OK

RunCommandListResult

确定

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

安全性

azure_auth

Azure Active Directory OAuth2 流

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

Scopes

名称 说明
user_impersonation 模拟用户帐户

示例

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."
    }
  ]
}

定义

名称 说明
OperatingSystemTypes

操作系统类型。

RunCommandDocumentBase

描述运行命令元数据的属性。

RunCommandListResult

列出虚拟机操作响应。

OperatingSystemTypes

操作系统类型。

名称 类型 说明
Linux

string

Windows

string

RunCommandDocumentBase

描述运行命令元数据的属性。

名称 类型 说明
$schema

string

VM 运行命令架构。

description

string

VM 运行命令说明。

id

string

VM 运行命令 ID。

label

string

VM 运行命令标签。

osType

OperatingSystemTypes

操作系统类型。

RunCommandListResult

列出虚拟机操作响应。

名称 类型 说明
nextLink

string

用于提取运行命令的下一页的 URI。 调用 ListNext () ,以获取运行命令的下一页。

value

RunCommandDocumentBase[]

虚拟机运行命令的列表。