Virtual Machines - Run Command
VM에서 명령을 실행합니다.
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand?api-version=2024-03-01
URI 매개 변수
Name | In(다음 안에) | 필수 | 형식 | Description |
---|---|---|---|---|
resource
|
path | True |
string |
리소스 그룹의 이름. |
subscription
|
path | True |
string |
Microsoft Azure 구독을 고유하게 식별하는 구독 자격 증명 구독 ID는 모든 서비스 호출에 대한 URI의 파트를 형성합니다. |
vm
|
path | True |
string |
가상 머신의 이름입니다. |
api-version
|
query | True |
string |
클라이언트 API 버전. |
요청 본문
Media Types: "application/json", "text/json"
Name | 필수 | 형식 | Description |
---|---|---|---|
commandId | True |
string |
실행 명령 ID입니다. |
parameters |
실행 명령 매개 변수입니다. |
||
script |
string[] |
선택 사항입니다. 실행할 스크립트입니다. 이 값이 지정되면 지정된 스크립트가 명령의 기본 스크립트를 재정의합니다. |
응답
Name | 형식 | Description |
---|---|---|
200 OK |
정상 Media Types: "application/json", "text/json" |
|
202 Accepted |
수락됨 Media Types: "application/json", "text/json" |
보안
azure_auth
Azure Active Directory OAuth2 Flow
형식:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Name | Description |
---|---|
user_impersonation | 사용자 계정 가장 |
예제
VirtualMachineRunCommand
Sample request
POST https://management.azure.com/subscriptions/24fb23e3-6ba3-41f0-9b6e-e41131d5d61e/resourceGroups/crptestar98131/providers/Microsoft.Compute/virtualMachines/vm3036/runCommand?api-version=2024-03-01
{
"commandId": "RunPowerShellScript"
}
Sample response
{
"value": [
{
"code": "ComponentStatus/StdOut/succeeded",
"level": "Info",
"displayStatus": "Provisioning succeeded",
"message": "This is a sample script with parameters value1 value2"
},
{
"code": "ComponentStatus/StdErr/succeeded",
"level": "Info",
"displayStatus": "Provisioning succeeded",
"message": ""
}
]
}
Location: https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/westus/operations/{operationId}&monitor=true&api-version=2024-03-01
정의
Name | Description |
---|---|
Instance |
인스턴스 보기 상태. |
Run |
Virtual Machine 매개 변수를 캡처합니다. |
Run |
실행 명령 매개 변수의 속성을 설명합니다. |
Run |
|
Status |
수준 코드입니다. |
InstanceViewStatus
인스턴스 보기 상태.
Name | 형식 | Description |
---|---|---|
code |
string |
상태 코드입니다. |
displayStatus |
string |
상태 대한 짧은 지역화 가능 레이블입니다. |
level |
수준 코드입니다. |
|
message |
string |
경고 및 오류 메시지를 포함하여 자세한 상태 메시지입니다. |
time |
string |
상태 시간입니다. |
RunCommandInput
Virtual Machine 매개 변수를 캡처합니다.
Name | 형식 | Description |
---|---|---|
commandId |
string |
실행 명령 ID입니다. |
parameters |
실행 명령 매개 변수입니다. |
|
script |
string[] |
선택 사항입니다. 실행할 스크립트입니다. 이 값이 지정되면 지정된 스크립트가 명령의 기본 스크립트를 재정의합니다. |
RunCommandInputParameter
실행 명령 매개 변수의 속성을 설명합니다.
Name | 형식 | Description |
---|---|---|
name |
string |
실행 명령 매개 변수 이름입니다. |
value |
string |
run 명령 매개 변수 값입니다. |
RunCommandResult
Name | 형식 | Description |
---|---|---|
value |
명령 작업 응답을 실행합니다. |
StatusLevelTypes
수준 코드입니다.
Name | 형식 | Description |
---|---|---|
Error |
string |
|
Info |
string |
|
Warning |
string |