mirror of
https://github.com/hanzoai/azure-sdk-for-js.git
synced 2026-10-30 19:51:51 +00:00
26 lines
1.0 KiB
TypeScript
26 lines
1.0 KiB
TypeScript
// Copyright (c) Microsoft Corporation.
|
|
// Licensed under the MIT License.
|
|
|
|
/**
|
|
* This sample demonstrates how to Restart a virtual machine. This operation can take a while to complete.
|
|
*
|
|
* @summary Restart a virtual machine. This operation can take a while to complete.
|
|
* x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Restart.json
|
|
*/
|
|
|
|
import { DevTestLabsClient } from "@azure/arm-devtestlabs";
|
|
import { DefaultAzureCredential } from "@azure/identity";
|
|
|
|
async function virtualMachinesRestart(): Promise<void> {
|
|
const subscriptionId = "{subscriptionId}";
|
|
const resourceGroupName = "resourceGroupName";
|
|
const labName = "{labName}";
|
|
const name = "{vmName}";
|
|
const credential = new DefaultAzureCredential();
|
|
const client = new DevTestLabsClient(credential, subscriptionId);
|
|
const result = await client.virtualMachines.beginRestartAndWait(resourceGroupName, labName, name);
|
|
console.log(result);
|
|
}
|
|
|
|
virtualMachinesRestart().catch(console.error);
|