Skip to main content

virtual_machine_scale_sets

Creates, updates, deletes, gets or lists a virtual_machine_scale_sets resource.

Overview

Namevirtual_machine_scale_sets
TypeResource
Idazure.compute.virtual_machine_scale_sets

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringResource Id
namestringResource name
etagstringEtag is property returned in Create/Update/Get response of the VMSS, so that customer can supply it in the header to ensure optimistic updates
extendedLocationobjectThe extended location of the Virtual Machine Scale Set.
identityobjectThe identity of the virtual machine scale set, if configured.
locationstringResource location
planobjectSpecifies information about the marketplace image used to create the virtual machine. This element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then click Want to deploy programmatically, Get Started ->. Enter any required information and then click Save.
propertiesobjectDescribes the properties of a Virtual Machine Scale Set.
skuobjectThe virtual machine scale set sku.
tagsobjectResource tags
typestringResource type
zonesarrayThe virtual machine scale set zones.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectresourceGroupName, vmScaleSetName, subscriptionId$expandDisplay information about a virtual machine scale set.
get_instance_viewselectresourceGroupName, vmScaleSetName, subscriptionIdGets the status of a VM scale set instance.
list_by_locationselectlocation, subscriptionIdGets all the VM scale sets under the specified subscription for the specified location.
listselectresourceGroupName, subscriptionIdGets a list of all VM scale sets under a resource group.
list_allselectsubscriptionIdGets a list of all VM Scale Sets in the subscription, regardless of the associated resource group. Use nextLink property in the response to get the next page of VM Scale Sets. Do this till nextLink is null to fetch all the VM Scale Sets.
create_or_updateinsertresourceGroupName, vmScaleSetName, subscriptionIdIf-Match, If-None-MatchCreate or update a VM scale set.
updateupdateresourceGroupName, vmScaleSetName, subscriptionIdIf-Match, If-None-MatchUpdate a VM scale set.
deletedeleteresourceGroupName, vmScaleSetName, subscriptionIdforceDeletionDeletes a VM scale set.
deallocateexecresourceGroupName, vmScaleSetName, subscriptionIdhibernateDeallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the compute resources. You are not billed for the compute resources that this virtual machine scale set deallocates.
delete_instancesexecresourceGroupName, vmScaleSetName, subscriptionId, instanceIdsforceDeletionDeletes virtual machines in a VM scale set.
power_offexecresourceGroupName, vmScaleSetName, subscriptionIdskipShutdownPower 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.
restartexecresourceGroupName, vmScaleSetName, subscriptionIdRestarts one or more virtual machines in a VM scale set.
startexecresourceGroupName, vmScaleSetName, subscriptionIdStarts one or more virtual machines in a VM scale set.
reapplyexecresourceGroupName, vmScaleSetName, subscriptionIdReapplies the Virtual Machine Scale Set Virtual Machine Profile to the Virtual Machine Instances
redeployexecresourceGroupName, vmScaleSetName, subscriptionIdShuts down all the virtual machines in the virtual machine scale set, moves them to a new node, and powers them back on.
perform_maintenanceexecresourceGroupName, vmScaleSetName, subscriptionIdPerform maintenance on one or more virtual machines in a VM scale set. Operation on instances which are not eligible for perform maintenance will be failed. Please refer to best practices for more details: https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications
reimageexecresourceGroupName, vmScaleSetName, subscriptionIdReimages (upgrade the operating system) one or more virtual machines in a VM scale set which don't have a ephemeral OS disk, for virtual machines who have a ephemeral OS disk the virtual machine is reset to initial state.
reimage_allexecresourceGroupName, vmScaleSetName, subscriptionIdReimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This operation is only supported for managed disks.
approve_rolling_upgradeexecresourceGroupName, vmScaleSetName, subscriptionIdApprove upgrade on deferred rolling upgrades for OS disks in the virtual machines in a VM scale set.
force_recovery_service_fabric_platform_update_domain_walkexecresourceGroupName, vmScaleSetName, subscriptionId, platformUpdateDomainzone, placementGroupIdManual platform update domain walk to update virtual machines in a service fabric virtual machine scale set.
convert_to_single_placement_groupexecresourceGroupName, vmScaleSetName, subscriptionIdConverts SinglePlacementGroup property to false for a existing virtual machine scale set.
set_orchestration_service_stateexecresourceGroupName, vmScaleSetName, subscriptionId, serviceName, actionChanges ServiceState property for a given service

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
locationstringThe location for which VM scale sets under the subscription are queried.
platformUpdateDomainintegerThe platform update domain for which a manual recovery walk is requested
resourceGroupNamestringThe name of the resource group.
subscriptionIdstringSubscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
vmScaleSetNamestringThe name of the virtual machine scale set to create or update.
$expandstringThe expand expression to apply on the operation. 'UserData' retrieves the UserData property of the VM scale set that was provided by the user during the VM scale set Create/Update operation
If-MatchstringThe ETag of the transformation. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting concurrent changes.
If-None-MatchstringSet to '*' to allow a new record set to be created, but to prevent updating an existing record set. Other values will result in error from server as they are not supported.
forceDeletionbooleanOptional parameter to force delete virtual machines from the VM scale set. (Feature in Preview)
hibernatebooleanOptional parameter to hibernate a virtual machine from the VM scale set. (This feature is available for VMSS with Flexible OrchestrationMode only)
placementGroupIdstringThe placement group id for which the manual recovery walk is requested.
skipShutdownbooleanThe 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
zonestringThe zone in which the manual recovery walk is requested for cross zone virtual machine scale set

SELECT examples

Display information about a virtual machine scale set.

SELECT
id,
name,
etag,
extendedLocation,
identity,
location,
plan,
properties,
sku,
tags,
type,
zones
FROM azure.compute.virtual_machine_scale_sets
WHERE resourceGroupName = '{{ resourceGroupName }}' -- required
AND vmScaleSetName = '{{ vmScaleSetName }}' -- required
AND subscriptionId = '{{ subscriptionId }}' -- required
AND $expand = '{{ $expand }}'
;

INSERT examples

Create or update a VM scale set.

INSERT INTO azure.compute.virtual_machine_scale_sets (
data__sku,
data__plan,
data__properties,
data__identity,
data__zones,
data__extendedLocation,
data__location,
data__tags,
resourceGroupName,
vmScaleSetName,
subscriptionId,
If-Match,
If-None-Match
)
SELECT
'{{ sku }}',
'{{ plan }}',
'{{ properties }}',
'{{ identity }}',
'{{ zones }}',
'{{ extendedLocation }}',
'{{ location }}',
'{{ tags }}',
'{{ resourceGroupName }}',
'{{ vmScaleSetName }}',
'{{ subscriptionId }}',
'{{ If-Match }}',
'{{ If-None-Match }}'
RETURNING
id,
name,
etag,
extendedLocation,
identity,
location,
plan,
properties,
sku,
tags,
type,
zones
;

UPDATE examples

Update a VM scale set.

UPDATE azure.compute.virtual_machine_scale_sets
SET
data__sku = '{{ sku }}',
data__plan = '{{ plan }}',
data__properties = '{{ properties }}',
data__identity = '{{ identity }}',
data__zones = '{{ zones }}',
data__tags = '{{ tags }}'
WHERE
resourceGroupName = '{{ resourceGroupName }}' --required
AND vmScaleSetName = '{{ vmScaleSetName }}' --required
AND subscriptionId = '{{ subscriptionId }}' --required
AND If-Match = '{{ If-Match}}'
AND If-None-Match = '{{ If-None-Match}}'
RETURNING
id,
name,
etag,
extendedLocation,
identity,
location,
plan,
properties,
sku,
tags,
type,
zones;

DELETE examples

Deletes a VM scale set.

DELETE FROM azure.compute.virtual_machine_scale_sets
WHERE resourceGroupName = '{{ resourceGroupName }}' --required
AND vmScaleSetName = '{{ vmScaleSetName }}' --required
AND subscriptionId = '{{ subscriptionId }}' --required
AND forceDeletion = '{{ forceDeletion }}'
;

Lifecycle Methods

Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the compute resources. You are not billed for the compute resources that this virtual machine scale set deallocates.

EXEC azure.compute.virtual_machine_scale_sets.deallocate 
@resourceGroupName='{{ resourceGroupName }}' --required,
@vmScaleSetName='{{ vmScaleSetName }}' --required,
@subscriptionId='{{ subscriptionId }}' --required,
@hibernate={{ hibernate }}
@@json=
'{
"instanceIds": "{{ instanceIds }}"
}'
;