구독에 직렬 콘솔 사용
제공된 구독의 모든 VM 및 VM 확장 집합에 대해 직렬 콘솔 서비스를 사용하도록 설정합니다.
POST https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.SerialConsole/consoleServices/{default}/enableConsole?api-version=2018-05-01
URI 매개 변수
Name |
In(다음 안에) |
필수 |
형식 |
Description |
default
|
path |
True
|
string
|
기본 매개 변수입니다. 값을 "default"로 둡니다.
|
subscriptionId
|
path |
True
|
string
|
Microsoft Azure 구독을 고유하게 식별하는 구독 ID입니다. 구독 ID는 필요한 모든 서비스 호출에 대한 URI의 일부를 형성합니다.
|
api-version
|
query |
True
|
string
|
이 작업에 사용할 API 버전입니다.
|
응답
보안
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
|
사용자 계정 가장
|
예제
Enable Serial Console for a subscription
Sample Request
POST https://management.azure.com/subscriptions/00000000-00000-0000-0000-000000000000/providers/Microsoft.SerialConsole/consoleServices/default/enableConsole?api-version=2018-05-01
from azure.identity import DefaultAzureCredential
from azure.mgmt.serialconsole import MicrosoftSerialConsoleClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-serialconsole
# USAGE
python enable_serial_console_for_a_subscription.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = MicrosoftSerialConsoleClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-00000-0000-0000-000000000000",
)
response = client.enable_console(
default="default",
)
print(response)
# x-ms-original-file: specification/serialconsole/resource-manager/Microsoft.SerialConsole/stable/2018-05-01/examples/EnableConsoleExamples.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armserialconsole_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/serialconsole/armserialconsole"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/serialconsole/resource-manager/Microsoft.SerialConsole/stable/2018-05-01/examples/EnableConsoleExamples.json
func ExampleMicrosoftSerialConsoleClient_EnableConsole() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armserialconsole.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewMicrosoftSerialConsoleClient().EnableConsole(ctx, "default", nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Value = armserialconsole.EnableSerialConsoleResult{
// Disabled: to.Ptr(false),
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { MicrosoftSerialConsoleClient } = require("@azure/arm-serialconsole");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Enables the Serial Console service for all VMs and VM scale sets in the provided subscription
*
* @summary Enables the Serial Console service for all VMs and VM scale sets in the provided subscription
* x-ms-original-file: specification/serialconsole/resource-manager/Microsoft.SerialConsole/stable/2018-05-01/examples/EnableConsoleExamples.json
*/
async function enableSerialConsoleForASubscription() {
const subscriptionId = "00000000-00000-0000-0000-000000000000";
const defaultParam = "default";
const credential = new DefaultAzureCredential();
const client = new MicrosoftSerialConsoleClient(credential, subscriptionId);
const result = await client.enableConsole(defaultParam);
console.log(result);
}
enableSerialConsoleForASubscription().catch(console.error);
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
{
"properties": {
"disabled": false
}
}
{
"code": "SubscriptionNotFound",
"message": "The subscription '00000000-00000-0000-0000-000000000000' could not be found."
}
정의
EnableSerialConsoleResult
직렬 콘솔 결과 사용
Name |
형식 |
Description |
disabled
|
boolean
|
직렬 콘솔을 사용하지 않도록 설정했는지 여부(사용).
|
GetSerialConsoleSubscriptionNotFound
직렬 콘솔 구독을 찾을 수 없음
Name |
형식 |
Description |
code
|
string
|
오류 코드
|
message
|
string
|
구독을 찾을 수 없음 메시지
|