Aktivera seriekonsol för en prenumeration
Aktiverar seriekonsoltjänsten för alla virtuella datorer och VM-skalningsuppsättningar i den angivna prenumerationen
POST https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.SerialConsole/consoleServices/{default}/enableConsole?api-version=2018-05-01
URI-parametrar
Name |
I |
Obligatorisk |
Typ |
Description |
default
|
path |
True
|
string
|
Standardparameter. Lämna värdet som "standard".
|
subscriptionId
|
path |
True
|
string
|
Prenumerations-ID som unikt identifierar Microsoft Azure-prenumerationen. Prenumerations-ID:t utgör en del av URI:n för varje tjänstanrop som kräver det.
|
api-version
|
query |
True
|
string
|
Den API-version som ska användas för den här åtgärden.
|
Svar
Säkerhet
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
|
personifiera ditt användarkonto
|
Exempel
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."
}
Definitioner
EnableSerialConsoleResult
Aktivera resultat för seriekonsol
Name |
Typ |
Description |
disabled
|
boolean
|
Oavsett om seriekonsolen är inaktiverad (aktiverad).
|
GetSerialConsoleSubscriptionNotFound
Det går inte att hitta seriekonsolprenumerationen
Name |
Typ |
Description |
code
|
string
|
Felkod
|
message
|
string
|
Meddelande om att prenumerationen inte hittades
|