Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still attached and you are getting charged for the resources. Instead, use deallocate to release resources and avoid charges.
HTTP
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff?api-version=2022-08-01
With optional parameters:
HTTP
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff?skipShutdown={skipShutdown}&api-version=2022-08-01
URI Parameters
Name
In
Required
Type
Description
resourceGroupName
path
True
string
The name of the resource group.
subscriptionId
path
True
string
Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
vmScaleSetName
path
True
string
The name of the VM scale set.
api-version
query
True
string
Client Api Version.
skipShutdown
query
boolean
The parameter to request non-graceful VM shutdown. True value for this flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not specified
Request Body
Name
Type
Description
instanceIds
string[]
The virtual machine scale set instance ids. Omitting the virtual machine scale set instance ids will result in the operation being performed on all virtual machines in the virtual machine scale set.
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still attached and you are getting charged for the resources. Instead, use deallocate to release resources and avoid charges.
*
* @summary Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still attached and you are getting charged for the resources. Instead, use deallocate to release resources and avoid charges.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_PowerOff_MaximumSet_Gen.json
*/asyncfunctionvirtualMachineScaleSetsPowerOffMaximumSetGen() {
const subscriptionId = "{subscription-id}";
const resourceGroupName = "rgcompute";
const vmScaleSetName = "aaaaaaaaaaaaaaaaaa";
const skipShutdown = true;
const vmInstanceIDs = {
instanceIds: ["aaaaaaaaaaaaaaaaa"],
};
const options = {
skipShutdown,
vmInstanceIDs,
};
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.virtualMachineScaleSets.beginPowerOffAndWait(
resourceGroupName,
vmScaleSetName,
options
);
console.log(result);
}
virtualMachineScaleSetsPowerOffMaximumSetGen().catch(console.error);
POST https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/virtualMachineScaleSets/a/poweroff?api-version=2022-08-01
Java
import com.azure.core.util.Context;
/** Samples for VirtualMachineScaleSets PowerOff. */publicfinalclassMain{
/*
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_PowerOff_MinimumSet_Gen.json
*//**
* Sample code: VirtualMachineScaleSets_PowerOff_MinimumSet_Gen.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/publicstaticvoidvirtualMachineScaleSetsPowerOffMinimumSetGen(
com.azure.resourcemanager.AzureResourceManager azure){
azure
.virtualMachines()
.manager()
.serviceClient()
.getVirtualMachineScaleSets()
.powerOff("rgcompute", "a", null, null, Context.NONE);
}
}
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still attached and you are getting charged for the resources. Instead, use deallocate to release resources and avoid charges.
*
* @summary Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still attached and you are getting charged for the resources. Instead, use deallocate to release resources and avoid charges.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2022-08-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSets_PowerOff_MinimumSet_Gen.json
*/asyncfunctionvirtualMachineScaleSetsPowerOffMinimumSetGen() {
const subscriptionId = "{subscription-id}";
const resourceGroupName = "rgcompute";
const vmScaleSetName = "a";
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.virtualMachineScaleSets.beginPowerOffAndWait(
resourceGroupName,
vmScaleSetName
);
console.log(result);
}
virtualMachineScaleSetsPowerOffMinimumSetGen().catch(console.error);
Specifies a list of virtual machine instance IDs from the VM scale set.
Name
Type
Description
instanceIds
string[]
The virtual machine scale set instance ids. Omitting the virtual machine scale set instance ids will result in the operation being performed on all virtual machines in the virtual machine scale set.