Virtual Machine Run Commands - List
列出某个位置中订阅的所有可用运行命令。
GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands?api-version=2025-04-01
URI 参数
| 名称 | 在 | 必需 | 类型 | 说明 |
|---|---|---|---|---|
|
location
|
path | True |
string minLength: 1 |
Azure 区域的名称。 |
|
subscription
|
path | True |
string minLength: 1 |
目标订阅的 ID。 |
|
api-version
|
query | True |
string minLength: 1 |
要用于此操作的 API 版本。 |
响应
| 名称 | 类型 | 说明 |
|---|---|---|
| 200 OK |
请求已成功。 Media Types: "application/json", "text/json" |
|
| Other Status Codes |
意外错误响应。 Media Types: "application/json", "text/json" |
安全性
azure_auth
Azure Active Directory OAuth2 Flow。
类型:
oauth2
流向:
implicit
授权 URL:
https://login.microsoftonline.com/common/oauth2/authorize
作用域
| 名称 | 说明 |
|---|---|
| user_impersonation | 模拟用户帐户 |
示例
VirtualMachineRunCommandList
示例请求
示例响应
{
"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."
}
]
}
定义
| 名称 | 说明 |
|---|---|
|
Api |
API 错误。 |
|
Api |
Api 错误库。 |
|
Cloud |
来自计算服务的错误响应。 |
|
Inner |
内部错误详细信息。 |
|
Operating |
此属性允许指定从用户映像或专用 VHD 创建 VM 时磁盘中包含的 OS 类型。 可能的值包括:Windows、Linux。 |
|
Run |
描述运行命令元数据的属性。 |
|
Run |
列出虚拟机作响应。 |
ApiError
API 错误。
| 名称 | 类型 | 说明 |
|---|---|---|
| code |
string |
错误代码。 |
| details |
Api 错误详细信息 |
|
| innererror |
Api 内部错误 |
|
| message |
string |
错误消息。 |
| target |
string |
特定错误的目标。 |
ApiErrorBase
Api 错误库。
| 名称 | 类型 | 说明 |
|---|---|---|
| code |
string |
错误代码。 |
| message |
string |
错误消息。 |
| target |
string |
特定错误的目标。 |
CloudError
来自计算服务的错误响应。
| 名称 | 类型 | 说明 |
|---|---|---|
| error |
API 错误。 |
InnerError
内部错误详细信息。
| 名称 | 类型 | 说明 |
|---|---|---|
| errordetail |
string |
内部错误消息或异常转储。 |
| exceptiontype |
string |
异常类型。 |
OperatingSystemTypes
此属性允许指定从用户映像或专用 VHD 创建 VM 时磁盘中包含的 OS 类型。 可能的值包括:Windows、Linux。
| 值 | 说明 |
|---|---|
| Windows | |
| Linux |
RunCommandDocumentBase
描述运行命令元数据的属性。
| 名称 | 类型 | 说明 |
|---|---|---|
| $schema |
string |
VM 运行命令架构。 |
| description |
string |
VM 运行命令说明。 |
| id |
string |
VM 运行命令 ID。 |
| label |
string |
VM 运行命令标签。 |
| osType |
操作系统类型。 |
RunCommandListResult
列出虚拟机作响应。
| 名称 | 类型 | 说明 |
|---|---|---|
| nextLink |
string (uri) |
用于提取下一页运行命令的 uri。 使用 this 调用 ListNext() 以获取运行命令的下一页。 |
| value |
虚拟机运行命令的列表。 |