共用方式為


Virtual Machine Run Commands - List

列出位置中訂用帳戶的所有可用執行命令。

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

URI 參數

名稱 位於 必要 類型 Description
location
path True

string

查詢執行命令的位置。

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

subscriptionId
path True

string

可唯一識別Microsoft Azure 訂用帳戶的訂用帳戶認證。 訂用帳戶標識碼會形成每個服務呼叫 URI 的一部分。

api-version
query True

string

用戶端 API 版本。

回應

名稱 類型 Description
200 OK

RunCommandListResult

還行

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

安全性

azure_auth

Azure Active Directory OAuth2 Flow

類型: oauth2
Flow: implicit
授權 URL: https://login.microsoftonline.com/common/oauth2/authorize

範圍

名稱 Description
user_impersonation 模擬您的用戶帳戶

範例

VirtualMachineRunCommandList

範例要求

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

範例回覆

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

定義

名稱 Description
OperatingSystemTypes

操作系統類型。

RunCommandDocumentBase

描述執行命令元數據的屬性。

RunCommandListResult

列出虛擬機作業回應。

OperatingSystemTypes

操作系統類型。

名稱 類型 Description
Linux

string

Windows

string

RunCommandDocumentBase

描述執行命令元數據的屬性。

名稱 類型 Description
$schema

string

VM 執行命令架構。

description

string

VM 執行命令描述。

id

string

VM 執行命令標識碼。

label

string

VM 執行命令標籤。

osType

OperatingSystemTypes

操作系統類型。

RunCommandListResult

列出虛擬機作業回應。

名稱 類型 Description
nextLink

string

要擷取執行命令下一頁的 URI。 使用此呼叫 ListNext(),以擷取執行命令的下一頁。

value

RunCommandDocumentBase[]

虛擬機執行命令的清單。