virtual_machine_scale_set_vms
Creates, updates, deletes, gets or lists a virtual_machine_scale_set_vms resource.
Overview
| Name | virtual_machine_scale_set_vms |
| Type | Resource |
| Id | azure.compute.virtual_machine_scale_set_vms |
Fields
The following fields are returned by SELECT queries:
- get
- list
| Name | Datatype | Description |
|---|---|---|
id | string | Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. |
name | string | The name of the resource. |
additionalCapabilities | object | Specifies additional capabilities enabled or disabled on the virtual machine in the scale set. For instance: whether the virtual machine has the capability to support attaching managed data disks with UltraSSD_LRS storage account type. |
availabilitySet | object | SubResource. |
diagnosticsProfile | object | Specifies the boot diagnostic settings state. Minimum api-version: 2015-06-15. |
etag | string | Etag is property returned in Update/Get response of the VMSS VM, so that customer can supply it in the header to ensure optimistic updates. |
hardwareProfile | object | Specifies the hardware settings for the virtual machine. |
identity | object | The identity of the virtual machine, if configured. |
instanceId | string | The virtual machine instance ID. |
instanceView | object | The virtual machine instance view. |
interconnectBlockProfile | object | Specifies the Interconnect Block related details of a Scale Set VM instance. Minimum api-version: 2026-03-01. |
latestModelApplied | boolean | Specifies whether the latest model has been applied to the virtual machine. |
licenseType | string | Specifies that the image or disk that is being used was licensed on-premises. Possible values for Windows Server operating system are: Windows_Client Windows_Server Possible values for Linux Server operating system are: RHEL_BYOS (for RHEL) SLES_BYOS (for SUSE) For more information, see Azure Hybrid Use Benefit for Windows Server _ Azure Hybrid Use Benefit for Linux Server _ Minimum api-version: 2015-06-15. |
location | string | The geo-location where the resource lives. Required. |
modelDefinitionApplied | string | Specifies whether the model applied to the virtual machine is the model of the virtual machine scale set or the customized model for the virtual machine. |
networkProfile | object | Specifies the network interfaces of the virtual machine. |
networkProfileConfiguration | object | Specifies the network profile configuration of the virtual machine. |
osProfile | object | Specifies the operating system settings for the virtual machine. |
plan | object | Specifies 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. |
protectionPolicy | object | Specifies the protection policy of the virtual machine. |
provisioningState | string | The provisioning state, which only appears in the response. |
resilientVMDeletionStatus | string | Specifies the resilient VM deletion status for the virtual machine. Known values are: "Enabled", "Disabled", "InProgress", and "Failed". (Enabled, Disabled, InProgress, Failed) |
resources | array | The virtual machine child extension resources. |
securityProfile | object | Specifies the Security related profile settings for the virtual machine. |
sku | object | The virtual machine SKU. |
storageProfile | object | Specifies the storage settings for the virtual machine disks. |
systemData | object | Azure Resource Manager metadata containing createdBy and modifiedBy information. |
tags | object | Resource tags. |
timeCreated | string (date-time) | Specifies the time at which the Virtual Machine resource was created. Minimum api-version: 2021-11-01. |
type | string | The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". |
userData | string | UserData for the VM, which must be base-64 encoded. Customer should not pass any secrets in here. Minimum api-version: 2021-03-01. |
virtualMachineResourceId | string | Specifies the ARM resource ID of the standalone virtual machine associated with this VMSS VM. This property is only applicable to Virtual Machine Scale Sets with Flexible orchestration mode. Minimum api-version: 2025-11-01. |
vmId | string | Azure VM unique ID. |
zones | array | The virtual machine zones. |
| Name | Datatype | Description |
|---|---|---|
id | string | Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. |
name | string | The name of the resource. |
additionalCapabilities | object | Specifies additional capabilities enabled or disabled on the virtual machine in the scale set. For instance: whether the virtual machine has the capability to support attaching managed data disks with UltraSSD_LRS storage account type. |
availabilitySet | object | SubResource. |
diagnosticsProfile | object | Specifies the boot diagnostic settings state. Minimum api-version: 2015-06-15. |
etag | string | Etag is property returned in Update/Get response of the VMSS VM, so that customer can supply it in the header to ensure optimistic updates. |
hardwareProfile | object | Specifies the hardware settings for the virtual machine. |
identity | object | The identity of the virtual machine, if configured. |
instanceId | string | The virtual machine instance ID. |
instanceView | object | The virtual machine instance view. |
interconnectBlockProfile | object | Specifies the Interconnect Block related details of a Scale Set VM instance. Minimum api-version: 2026-03-01. |
latestModelApplied | boolean | Specifies whether the latest model has been applied to the virtual machine. |
licenseType | string | Specifies that the image or disk that is being used was licensed on-premises. Possible values for Windows Server operating system are: Windows_Client Windows_Server Possible values for Linux Server operating system are: RHEL_BYOS (for RHEL) SLES_BYOS (for SUSE) For more information, see Azure Hybrid Use Benefit for Windows Server _ Azure Hybrid Use Benefit for Linux Server _ Minimum api-version: 2015-06-15. |
location | string | The geo-location where the resource lives. Required. |
modelDefinitionApplied | string | Specifies whether the model applied to the virtual machine is the model of the virtual machine scale set or the customized model for the virtual machine. |
networkProfile | object | Specifies the network interfaces of the virtual machine. |
networkProfileConfiguration | object | Specifies the network profile configuration of the virtual machine. |
osProfile | object | Specifies the operating system settings for the virtual machine. |
plan | object | Specifies 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. |
protectionPolicy | object | Specifies the protection policy of the virtual machine. |
provisioningState | string | The provisioning state, which only appears in the response. |
resilientVMDeletionStatus | string | Specifies the resilient VM deletion status for the virtual machine. Known values are: "Enabled", "Disabled", "InProgress", and "Failed". (Enabled, Disabled, InProgress, Failed) |
resources | array | The virtual machine child extension resources. |
securityProfile | object | Specifies the Security related profile settings for the virtual machine. |
sku | object | The virtual machine SKU. |
storageProfile | object | Specifies the storage settings for the virtual machine disks. |
systemData | object | Azure Resource Manager metadata containing createdBy and modifiedBy information. |
tags | object | Resource tags. |
timeCreated | string (date-time) | Specifies the time at which the Virtual Machine resource was created. Minimum api-version: 2021-11-01. |
type | string | The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". |
userData | string | UserData for the VM, which must be base-64 encoded. Customer should not pass any secrets in here. Minimum api-version: 2021-03-01. |
virtualMachineResourceId | string | Specifies the ARM resource ID of the standalone virtual machine associated with this VMSS VM. This property is only applicable to Virtual Machine Scale Sets with Flexible orchestration mode. Minimum api-version: 2025-11-01. |
vmId | string | Azure VM unique ID. |
zones | array | The virtual machine zones. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | resource_group_name, vm_scale_set_name, instance_id, subscription_id | $expand | Gets a virtual machine from a VM scale set. |
list | select | resource_group_name, virtual_machine_scale_set_name, subscription_id | $filter, $select, $expand | Gets a list of all virtual machines in a VM scale sets. |
update | update | resource_group_name, vm_scale_set_name, instance_id, subscription_id, location | Updates a virtual machine of a VM scale set. | |
delete | delete | resource_group_name, vm_scale_set_name, instance_id, subscription_id | forceDeletion | Deletes a virtual machine from a VM scale set. |
get_instance_view | exec | resource_group_name, vm_scale_set_name, instance_id, subscription_id | Gets the status of a virtual machine from a VM scale set. | |
approve_rolling_upgrade | exec | resource_group_name, vm_scale_set_name, instance_id, subscription_id | Approve upgrade on deferred rolling upgrade for OS disk on a VM scale set instance. | |
deallocate | exec | resource_group_name, vm_scale_set_name, instance_id, subscription_id | Deallocates 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. | |
reimage | exec | resource_group_name, vm_scale_set_name, instance_id, subscription_id | Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. | |
reimage_all | exec | resource_group_name, vm_scale_set_name, instance_id, subscription_id | Allows 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. | |
simulate_eviction | exec | resource_group_name, vm_scale_set_name, instance_id, subscription_id | The operation to simulate the eviction of spot virtual machine in a VM scale set. | |
attach_detach_data_disks | exec | resource_group_name, vm_scale_set_name, instance_id, subscription_id | Attach and detach data disks to/from a virtual machine in a VM scale set. | |
perform_maintenance | exec | resource_group_name, vm_scale_set_name, instance_id, subscription_id | Performs maintenance on a virtual machine in a VM scale set. | |
power_off | exec | resource_group_name, vm_scale_set_name, instance_id, subscription_id | skipShutdown | Power 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. |
redeploy | exec | resource_group_name, vm_scale_set_name, instance_id, subscription_id | Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back on. | |
restart | exec | resource_group_name, vm_scale_set_name, instance_id, subscription_id | Restarts a virtual machine in a VM scale set. | |
retrieve_boot_diagnostics_data | exec | resource_group_name, vm_scale_set_name, instance_id, subscription_id | sasUriExpirationTimeInMinutes | The operation to retrieve SAS URIs of boot diagnostic logs for a virtual machine in a VM scale set. |
start | exec | resource_group_name, vm_scale_set_name, instance_id, subscription_id | Starts a virtual machine in a VM scale set. | |
run_command | exec | resource_group_name, vm_scale_set_name, instance_id, subscription_id, commandId | Run command on 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.
| Name | Datatype | Description |
|---|---|---|
instance_id | string | The instance ID of the virtual machine. Required. |
resource_group_name | string | The name of the resource group. The name is case insensitive. Required. |
subscription_id | string | |
virtual_machine_scale_set_name | string | The name of the VirtualMachineScaleSet. Required. |
vm_scale_set_name | string | The name of the VM scale set. Required. |
$expand | string | The expand expression to apply to the operation. Allowed values are 'instanceView'. Default value is None. |
$filter | string | The filter to apply to the operation. Allowed values are 'startswith(instanceView/statuses/code, 'PowerState') eq true', 'properties/latestModelApplied eq true', 'properties/latestModelApplied eq false'. Default value is None. |
$select | string | The list parameters. Allowed values are 'instanceView', 'instanceView/statuses'. Default value is None. |
forceDeletion | boolean | Optional parameter to force delete a virtual machine from a VM scale set. (Feature in Preview). Default value is None. |
sasUriExpirationTimeInMinutes | integer | 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. Default value is None. |
skipShutdown | 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. Default value is None. |
SELECT examples
- get
- list
Gets a virtual machine from a VM scale set.
SELECT
id,
name,
additionalCapabilities,
availabilitySet,
diagnosticsProfile,
etag,
hardwareProfile,
identity,
instanceId,
instanceView,
interconnectBlockProfile,
latestModelApplied,
licenseType,
location,
modelDefinitionApplied,
networkProfile,
networkProfileConfiguration,
osProfile,
plan,
protectionPolicy,
provisioningState,
resilientVMDeletionStatus,
resources,
securityProfile,
sku,
storageProfile,
systemData,
tags,
timeCreated,
type,
userData,
virtualMachineResourceId,
vmId,
zones
FROM azure.compute.virtual_machine_scale_set_vms
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND vm_scale_set_name = '{{ vm_scale_set_name }}' -- required
AND instance_id = '{{ instance_id }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
AND $expand = '{{ $expand }}'
;
Gets a list of all virtual machines in a VM scale sets.
SELECT
id,
name,
additionalCapabilities,
availabilitySet,
diagnosticsProfile,
etag,
hardwareProfile,
identity,
instanceId,
instanceView,
interconnectBlockProfile,
latestModelApplied,
licenseType,
location,
modelDefinitionApplied,
networkProfile,
networkProfileConfiguration,
osProfile,
plan,
protectionPolicy,
provisioningState,
resilientVMDeletionStatus,
resources,
securityProfile,
sku,
storageProfile,
systemData,
tags,
timeCreated,
type,
userData,
virtualMachineResourceId,
vmId,
zones
FROM azure.compute.virtual_machine_scale_set_vms
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND virtual_machine_scale_set_name = '{{ virtual_machine_scale_set_name }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
AND $filter = '{{ $filter }}'
AND $select = '{{ $select }}'
AND $expand = '{{ $expand }}'
;
UPDATE examples
- update
Updates a virtual machine of a VM scale set.
UPDATE azure.compute.virtual_machine_scale_set_vms
SET
tags = '{{ tags }}',
location = '{{ location }}',
properties = '{{ properties }}',
plan = '{{ plan }}',
identity = '{{ identity }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND vm_scale_set_name = '{{ vm_scale_set_name }}' --required
AND instance_id = '{{ instance_id }}' --required
AND subscription_id = '{{ subscription_id }}' --required
AND location = '{{ location }}' --required
RETURNING
id,
name,
etag,
identity,
instanceId,
location,
plan,
properties,
resources,
sku,
systemData,
tags,
type,
zones;
DELETE examples
- delete
Deletes a virtual machine from a VM scale set.
DELETE FROM azure.compute.virtual_machine_scale_set_vms
WHERE resource_group_name = '{{ resource_group_name }}' --required
AND vm_scale_set_name = '{{ vm_scale_set_name }}' --required
AND instance_id = '{{ instance_id }}' --required
AND subscription_id = '{{ subscription_id }}' --required
AND forceDeletion = '{{ forceDeletion }}'
;
Lifecycle Methods
- get_instance_view
- approve_rolling_upgrade
- deallocate
- reimage
- reimage_all
- simulate_eviction
- attach_detach_data_disks
- perform_maintenance
- power_off
- redeploy
- restart
- retrieve_boot_diagnostics_data
- start
- run_command
Gets the status of a virtual machine from a VM scale set.
EXEC azure.compute.virtual_machine_scale_set_vms.get_instance_view
@resource_group_name='{{ resource_group_name }}' --required,
@vm_scale_set_name='{{ vm_scale_set_name }}' --required,
@instance_id='{{ instance_id }}' --required,
@subscription_id='{{ subscription_id }}' --required
;
Approve upgrade on deferred rolling upgrade for OS disk on a VM scale set instance.
EXEC azure.compute.virtual_machine_scale_set_vms.approve_rolling_upgrade
@resource_group_name='{{ resource_group_name }}' --required,
@vm_scale_set_name='{{ vm_scale_set_name }}' --required,
@instance_id='{{ instance_id }}' --required,
@subscription_id='{{ subscription_id }}' --required
;
Deallocates 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.
EXEC azure.compute.virtual_machine_scale_set_vms.deallocate
@resource_group_name='{{ resource_group_name }}' --required,
@vm_scale_set_name='{{ vm_scale_set_name }}' --required,
@instance_id='{{ instance_id }}' --required,
@subscription_id='{{ subscription_id }}' --required
;
Reimages (upgrade the operating system) a specific virtual machine in a VM scale set.
EXEC azure.compute.virtual_machine_scale_set_vms.reimage
@resource_group_name='{{ resource_group_name }}' --required,
@vm_scale_set_name='{{ vm_scale_set_name }}' --required,
@instance_id='{{ instance_id }}' --required,
@subscription_id='{{ subscription_id }}' --required
@@json=
'{
"tempDisk": {{ tempDisk }},
"exactVersion": "{{ exactVersion }}",
"osProfile": "{{ osProfile }}",
"forceUpdateOSDiskForEphemeral": {{ forceUpdateOSDiskForEphemeral }}
}'
;
Allows 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.
EXEC azure.compute.virtual_machine_scale_set_vms.reimage_all
@resource_group_name='{{ resource_group_name }}' --required,
@vm_scale_set_name='{{ vm_scale_set_name }}' --required,
@instance_id='{{ instance_id }}' --required,
@subscription_id='{{ subscription_id }}' --required
;
The operation to simulate the eviction of spot virtual machine in a VM scale set.
EXEC azure.compute.virtual_machine_scale_set_vms.simulate_eviction
@resource_group_name='{{ resource_group_name }}' --required,
@vm_scale_set_name='{{ vm_scale_set_name }}' --required,
@instance_id='{{ instance_id }}' --required,
@subscription_id='{{ subscription_id }}' --required
;
Attach and detach data disks to/from a virtual machine in a VM scale set.
EXEC azure.compute.virtual_machine_scale_set_vms.attach_detach_data_disks
@resource_group_name='{{ resource_group_name }}' --required,
@vm_scale_set_name='{{ vm_scale_set_name }}' --required,
@instance_id='{{ instance_id }}' --required,
@subscription_id='{{ subscription_id }}' --required
@@json=
'{
"dataDisksToAttach": "{{ dataDisksToAttach }}",
"dataDisksToDetach": "{{ dataDisksToDetach }}"
}'
;
Performs maintenance on a virtual machine in a VM scale set.
EXEC azure.compute.virtual_machine_scale_set_vms.perform_maintenance
@resource_group_name='{{ resource_group_name }}' --required,
@vm_scale_set_name='{{ vm_scale_set_name }}' --required,
@instance_id='{{ instance_id }}' --required,
@subscription_id='{{ subscription_id }}' --required
;
Power 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.
EXEC azure.compute.virtual_machine_scale_set_vms.power_off
@resource_group_name='{{ resource_group_name }}' --required,
@vm_scale_set_name='{{ vm_scale_set_name }}' --required,
@instance_id='{{ instance_id }}' --required,
@subscription_id='{{ subscription_id }}' --required,
@skipShutdown={{ skipShutdown }}
;
Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back on.
EXEC azure.compute.virtual_machine_scale_set_vms.redeploy
@resource_group_name='{{ resource_group_name }}' --required,
@vm_scale_set_name='{{ vm_scale_set_name }}' --required,
@instance_id='{{ instance_id }}' --required,
@subscription_id='{{ subscription_id }}' --required
;
Restarts a virtual machine in a VM scale set.
EXEC azure.compute.virtual_machine_scale_set_vms.restart
@resource_group_name='{{ resource_group_name }}' --required,
@vm_scale_set_name='{{ vm_scale_set_name }}' --required,
@instance_id='{{ instance_id }}' --required,
@subscription_id='{{ subscription_id }}' --required
;
The operation to retrieve SAS URIs of boot diagnostic logs for a virtual machine in a VM scale set.
EXEC azure.compute.virtual_machine_scale_set_vms.retrieve_boot_diagnostics_data
@resource_group_name='{{ resource_group_name }}' --required,
@vm_scale_set_name='{{ vm_scale_set_name }}' --required,
@instance_id='{{ instance_id }}' --required,
@subscription_id='{{ subscription_id }}' --required,
@sasUriExpirationTimeInMinutes='{{ sasUriExpirationTimeInMinutes }}'
;
Starts a virtual machine in a VM scale set.
EXEC azure.compute.virtual_machine_scale_set_vms.start
@resource_group_name='{{ resource_group_name }}' --required,
@vm_scale_set_name='{{ vm_scale_set_name }}' --required,
@instance_id='{{ instance_id }}' --required,
@subscription_id='{{ subscription_id }}' --required
;
Run command on a virtual machine in a VM scale set.
EXEC azure.compute.virtual_machine_scale_set_vms.run_command
@resource_group_name='{{ resource_group_name }}' --required,
@vm_scale_set_name='{{ vm_scale_set_name }}' --required,
@instance_id='{{ instance_id }}' --required,
@subscription_id='{{ subscription_id }}' --required
@@json=
'{
"commandId": "{{ commandId }}",
"script": "{{ script }}",
"parameters": "{{ parameters }}"
}'
;