Skip to main content

virtual_machine_scale_set_vms

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

Overview

Namevirtual_machine_scale_set_vms
TypeResource
Idazure.compute.virtual_machine_scale_set_vms

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringResource Id
namestringResource name
etagstringEtag is property returned in Update/Get response of the VMSS VM, so that customer can supply it in the header to ensure optimistic updates.
identityobjectThe identity of the virtual machine, if configured.
instanceIdstringThe virtual machine instance ID.
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 virtual machine.
resourcesarrayThe virtual machine child extension resources.
skuobjectThe virtual machine SKU.
tagsobjectResource tags
typestringResource type
zonesarrayThe virtual machine zones.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectresourceGroupName, vmScaleSetName, instanceId, subscriptionId$expandGets a virtual machine from a VM scale set.
get_instance_viewselectresourceGroupName, vmScaleSetName, instanceId, subscriptionIdGets the status of a virtual machine from a VM scale set.
listselectresourceGroupName, virtualMachineScaleSetName, subscriptionId$filter, $select, $expandGets a list of all virtual machines in a VM scale sets.
updatereplaceresourceGroupName, vmScaleSetName, instanceId, subscriptionIdIf-Match, If-None-MatchUpdates a virtual machine of a VM scale set.
deletedeleteresourceGroupName, vmScaleSetName, instanceId, subscriptionIdforceDeletionDeletes a virtual machine from a VM scale set.
run_commandexecresourceGroupName, vmScaleSetName, instanceId, subscriptionId, commandIdRun command on a virtual machine in a VM scale set.
reimageexecresourceGroupName, vmScaleSetName, instanceId, subscriptionIdReimages (upgrade the operating system) a specific virtual machine in a VM scale set.
reimage_allexecresourceGroupName, vmScaleSetName, instanceId, subscriptionIdAllows you to re-image all the disks ( including data disks ) in the a VM scale set instance. This operation is only supported for managed disks.
approve_rolling_upgradeexecresourceGroupName, vmScaleSetName, instanceId, subscriptionIdApprove upgrade on deferred rolling upgrade for OS disk on a VM scale set instance.
deallocateexecresourceGroupName, vmScaleSetName, instanceId, subscriptionIdDeallocates a specific virtual machine in a VM scale set. Shuts down the virtual machine and releases the compute resources it uses. You are not billed for the compute resources of this virtual machine once it is deallocated.
power_offexecresourceGroupName, vmScaleSetName, instanceId, subscriptionIdskipShutdownPower off (stop) a virtual machine 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, instanceId, subscriptionIdRestarts a virtual machine in a VM scale set.
startexecresourceGroupName, vmScaleSetName, instanceId, subscriptionIdStarts a virtual machine in a VM scale set.
redeployexecresourceGroupName, vmScaleSetName, instanceId, subscriptionIdShuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back on.
retrieve_boot_diagnostics_dataexecresourceGroupName, vmScaleSetName, instanceId, subscriptionIdsasUriExpirationTimeInMinutesThe operation to retrieve SAS URIs of boot diagnostic logs for a virtual machine in a VM scale set.
perform_maintenanceexecresourceGroupName, vmScaleSetName, instanceId, subscriptionIdPerforms maintenance on a virtual machine in a VM scale set.
simulate_evictionexecresourceGroupName, vmScaleSetName, instanceId, subscriptionIdThe operation to simulate the eviction of spot virtual machine in a VM scale set.
attach_detach_data_disksexecresourceGroupName, vmScaleSetName, instanceId, subscriptionIdAttach and detach data disks to/from a virtual machine in a VM scale set.

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
instanceIdstringThe instance ID of the virtual machine.
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.
virtualMachineScaleSetNamestringThe name of the VM scale set.
vmScaleSetNamestringThe name of the VM scale set.
$expandstringThe expand expression to apply to the operation. Allowed values are 'instanceView'.
$filterstringThe filter to apply to the operation. Allowed values are 'startswith(instanceView/statuses/code, 'PowerState') eq true', 'properties/latestModelApplied eq true', 'properties/latestModelApplied eq false'.
$selectstringThe list parameters. Allowed values are 'instanceView', 'instanceView/statuses'.
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 a virtual machine from a VM scale set. (Feature in Preview)
sasUriExpirationTimeInMinutesinteger (int32)Expiration duration in minutes for the SAS URIs with a value between 1 to 1440 minutes. Note: If not specified, SAS URIs will be generated with a default expiration duration of 120 minutes.
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

SELECT examples

Gets a virtual machine from a VM scale set.

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

REPLACE examples

Updates a virtual machine of a VM scale set.

REPLACE azure.compute.virtual_machine_scale_set_vms
SET
data__properties = '{{ properties }}',
data__plan = '{{ plan }}',
data__identity = '{{ identity }}',
data__location = '{{ location }}',
data__tags = '{{ tags }}'
WHERE
resourceGroupName = '{{ resourceGroupName }}' --required
AND vmScaleSetName = '{{ vmScaleSetName }}' --required
AND instanceId = '{{ instanceId }}' --required
AND subscriptionId = '{{ subscriptionId }}' --required
AND If-Match = '{{ If-Match}}'
AND If-None-Match = '{{ If-None-Match}}'
RETURNING
id,
name,
etag,
identity,
instanceId,
location,
plan,
properties,
resources,
sku,
tags,
type,
zones;

DELETE examples

Deletes a virtual machine from a VM scale set.

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

Lifecycle Methods

Run command on a virtual machine in a VM scale set.

EXEC azure.compute.virtual_machine_scale_set_vms.run_command 
@resourceGroupName='{{ resourceGroupName }}' --required,
@vmScaleSetName='{{ vmScaleSetName }}' --required,
@instanceId='{{ instanceId }}' --required,
@subscriptionId='{{ subscriptionId }}' --required
@@json=
'{
"commandId": "{{ commandId }}",
"script": "{{ script }}",
"parameters": "{{ parameters }}"
}'
;