Operasi untuk mematikan (menghentikan) komputer virtual. Komputer virtual dapat dimulai ulang dengan sumber daya yang disediakan yang sama. Anda masih dikenakan biaya untuk komputer virtual ini.
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff?api-version=2022-03-01
With optional parameters:
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff?skipShutdown={skipShutdown}&api-version=2022-03-01
Parameter URI
Name
In
Required
Type
Description
resourceGroupName
path
True
string
Nama grup sumber daya.
subscriptionId
path
True
string
Info masuk langganan yang secara unik mengidentifikasi langganan Microsoft Azure. ID langganan membentuk bagian dari URI untuk setiap panggilan layanan.
vmName
path
True
string
Nama mesin virtual.
api-version
query
True
string
Versi Api Klien.
skipShutdown
query
boolean
Parameter untuk meminta penonaktifan VM yang tidak anggun. Nilai benar untuk bendera ini menunjukkan pematian yang tidak baik sedangkan false menunjukkan sebaliknya. Nilai default untuk bendera ini adalah false jika tidak ditentukan
POST https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/virtualMachines/aaaaaaaaaaaaaaaaaaaaaaaaaaa/powerOff?skipShutdown=True&api-version=2022-03-01
import com.azure.core.util.Context;
/** Samples for VirtualMachines PowerOff. */
public final class Main {
/*
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2022-03-01/ComputeRP/examples/virtualMachineExamples/VirtualMachines_PowerOff_MaximumSet_Gen.json
*/
/**
* Sample code: VirtualMachines_PowerOff_MaximumSet_Gen.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void virtualMachinesPowerOffMaximumSetGen(com.azure.resourcemanager.AzureResourceManager azure) {
azure
.virtualMachines()
.manager()
.serviceClient()
.getVirtualMachines()
.powerOff("rgcompute", "aaaaaaaaaaaaaaaaaaaaaaaaaaa", true, Context.NONE);
}
}
Read this SDK documentation on how to add the SDK to your project and authenticate.
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v3"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/compute/resource-manager/Microsoft.Compute/stable/2022-03-01/ComputeRP/examples/virtualMachineExamples/VirtualMachines_PowerOff_MaximumSet_Gen.json
func ExampleVirtualMachinesClient_BeginPowerOff() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
client, err := armcompute.NewVirtualMachinesClient("{subscription-id}", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := client.BeginPowerOff(ctx,
"rgcompute",
"aaaaaaaaaaaaaaaaaaaaaaaaaaa",
&armcompute.VirtualMachinesClientBeginPowerOffOptions{SkipShutdown: to.Ptr(true)})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}
Read this SDK documentation on how to add the SDK to your project and authenticate.
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same provisioned resources. You are still charged for this virtual machine.
*
* @summary The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same provisioned resources. You are still charged for this virtual machine.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2022-03-01/ComputeRP/examples/virtualMachineExamples/VirtualMachines_PowerOff_MaximumSet_Gen.json
*/
async function virtualMachinesPowerOffMaximumSetGen() {
const subscriptionId = "{subscription-id}";
const resourceGroupName = "rgcompute";
const vmName = "aaaaaaaaaaaaaaaaaaaaaaaaaaa";
const skipShutdown = true;
const options = { skipShutdown };
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.virtualMachines.beginPowerOffAndWait(
resourceGroupName,
vmName,
options
);
console.log(result);
}
virtualMachinesPowerOffMaximumSetGen().catch(console.error);
Read this SDK documentation on how to add the SDK to your project and authenticate.
POST https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/virtualMachines/aaaaaaaaaaaaaaaaaa/powerOff?api-version=2022-03-01
import com.azure.core.util.Context;
/** Samples for VirtualMachines PowerOff. */
public final class Main {
/*
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2022-03-01/ComputeRP/examples/virtualMachineExamples/VirtualMachines_PowerOff_MinimumSet_Gen.json
*/
/**
* Sample code: VirtualMachines_PowerOff_MinimumSet_Gen.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void virtualMachinesPowerOffMinimumSetGen(com.azure.resourcemanager.AzureResourceManager azure) {
azure
.virtualMachines()
.manager()
.serviceClient()
.getVirtualMachines()
.powerOff("rgcompute", "aaaaaaaaaaaaaaaaaa", null, Context.NONE);
}
}
Read this SDK documentation on how to add the SDK to your project and authenticate.
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same provisioned resources. You are still charged for this virtual machine.
*
* @summary The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same provisioned resources. You are still charged for this virtual machine.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2022-03-01/ComputeRP/examples/virtualMachineExamples/VirtualMachines_PowerOff_MinimumSet_Gen.json
*/
async function virtualMachinesPowerOffMinimumSetGen() {
const subscriptionId = "{subscription-id}";
const resourceGroupName = "rgcompute";
const vmName = "aaaaaaaaaaaaaaaaaa";
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.virtualMachines.beginPowerOffAndWait(resourceGroupName, vmName);
console.log(result);
}
virtualMachinesPowerOffMinimumSetGen().catch(console.error);
Read this SDK documentation on how to add the SDK to your project and authenticate.