Mematikan komputer virtual dan melepaskan sumber daya komputasi. Anda tidak ditagih untuk sumber daya komputasi yang digunakan komputer virtual ini.
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate?api-version=2022-03-01
With optional parameters:
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate?hibernate={hibernate}&api-version=2022-03-01
Parameter URI
Name
In
Required
Type
Description
resourceGroupName
path
True
string
Nama grup sumber daya.
subscriptionId
path
True
string
Kredensial 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.
hibernate
query
boolean
Parameter opsional untuk hibernasi komputer virtual. (Fitur dalam Pratinjau)
POST https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/virtualMachines/aaaaaaaaaa/deallocate?hibernate=True&api-version=2022-03-01
import com.azure.core.util.Context;
/** Samples for VirtualMachines Deallocate. */
public final class Main {
/*
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2022-03-01/ComputeRP/examples/virtualMachineExamples/VirtualMachines_Deallocate_MaximumSet_Gen.json
*/
/**
* Sample code: VirtualMachines_Deallocate_MaximumSet_Gen.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void virtualMachinesDeallocateMaximumSetGen(com.azure.resourcemanager.AzureResourceManager azure) {
azure
.virtualMachines()
.manager()
.serviceClient()
.getVirtualMachines()
.deallocate("rgcompute", "aaaaaaaaaa", 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_Deallocate_MaximumSet_Gen.json
func ExampleVirtualMachinesClient_BeginDeallocate() {
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.BeginDeallocate(ctx,
"rgcompute",
"aaaaaaaaaa",
&armcompute.VirtualMachinesClientBeginDeallocateOptions{Hibernate: 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 Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources that this virtual machine uses.
*
* @summary Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources that this virtual machine uses.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2022-03-01/ComputeRP/examples/virtualMachineExamples/VirtualMachines_Deallocate_MaximumSet_Gen.json
*/
async function virtualMachinesDeallocateMaximumSetGen() {
const subscriptionId = "{subscription-id}";
const resourceGroupName = "rgcompute";
const vmName = "aaaaaaaaaa";
const hibernate = true;
const options = { hibernate };
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.virtualMachines.beginDeallocateAndWait(
resourceGroupName,
vmName,
options
);
console.log(result);
}
virtualMachinesDeallocateMaximumSetGen().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/aaaaaaaaaaaaaaaa/deallocate?api-version=2022-03-01
import com.azure.core.util.Context;
/** Samples for VirtualMachines Deallocate. */
public final class Main {
/*
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2022-03-01/ComputeRP/examples/virtualMachineExamples/VirtualMachines_Deallocate_MinimumSet_Gen.json
*/
/**
* Sample code: VirtualMachines_Deallocate_MinimumSet_Gen.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void virtualMachinesDeallocateMinimumSetGen(com.azure.resourcemanager.AzureResourceManager azure) {
azure
.virtualMachines()
.manager()
.serviceClient()
.getVirtualMachines()
.deallocate("rgcompute", "aaaaaaaaaaaaaaaa", 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 Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources that this virtual machine uses.
*
* @summary Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources that this virtual machine uses.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2022-03-01/ComputeRP/examples/virtualMachineExamples/VirtualMachines_Deallocate_MinimumSet_Gen.json
*/
async function virtualMachinesDeallocateMinimumSetGen() {
const subscriptionId = "{subscription-id}";
const resourceGroupName = "rgcompute";
const vmName = "aaaaaaaaaaaaaaaa";
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.virtualMachines.beginDeallocateAndWait(resourceGroupName, vmName);
console.log(result);
}
virtualMachinesDeallocateMinimumSetGen().catch(console.error);
Read this SDK documentation on how to add the SDK to your project and authenticate.