virtual_machines
Creates, updates, deletes, gets or lists a virtual_machines resource.
Overview
| Name | virtual_machines |
| Type | Resource |
| Id | azure.compute.virtual_machines |
Fields
The following fields are returned by SELECT queries:
- get
- list
- list_by_location
- list_all
| 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. |
applicationProfile | object | Specifies the gallery applications that should be made available to the VM/VMSS. |
availabilitySet | object | SubResource. |
billingProfile | object | Specifies the billing related details of a Azure Spot virtual machine. Minimum api-version: 2019-03-01. |
capacityReservation | object | Specifies information about the capacity reservation that is used to allocate virtual machine. Minimum api-version: 2021-04-01. |
diagnosticsProfile | object | Specifies the boot diagnostic settings state. Minimum api-version: 2015-06-15. |
etag | string | Etag is property returned in Create/Update/Get response of the VM, so that customer can supply it in the header to ensure optimistic updates. |
evictionPolicy | string | Specifies the eviction policy for the Azure Spot virtual machine and Azure Spot scale set. For Azure Spot virtual machines, both 'Deallocate' and 'Delete' are supported and the minimum api-version is 2019-03-01. For Azure Spot scale sets, both 'Deallocate' and 'Delete' are supported and the minimum api-version is 2017-10-30-preview. Known values are: "Deallocate" and "Delete". (Deallocate, Delete) |
extendedLocation | object | The extended location of the Virtual Machine. |
extensionsTimeBudget | string | Specifies the time alloted for all extensions to start. The time duration should be between 15 minutes and 120 minutes (inclusive) and should be specified in ISO 8601 format. The default value is 90 minutes (PT1H30M). Minimum api-version: 2020-06-01. |
hardwareProfile | object | Specifies the hardware settings for the virtual machine. |
host | object | SubResource. |
hostGroup | object | SubResource. |
identity | object | The identity of the virtual machine, if configured. |
instanceView | object | The virtual machine instance view. |
interconnectBlockProfile | object | Specifies information about the Interconnect Block that is used to allocate the Virtual Machine. Minimum api-version: 2026-03-01. |
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. |
managedBy | string | ManagedBy is set to Virtual Machine Scale Set(VMSS) flex ARM resourceID, if the VM is part of the VMSS. This property is used by platform for internal resource group delete optimization. |
networkProfile | object | Specifies the network interfaces of the virtual machine. |
osProfile | object | Specifies the operating system settings used while creating the virtual machine. Some of the settings cannot be changed once VM is provisioned. |
placement | object | Placement section specifies the user-defined constraints for virtual machine hardware placement. This property cannot be changed once VM is provisioned. Minimum api-version: 2024-11-01. |
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. |
platformFaultDomain | integer | Specifies the scale set logical fault domain into which the Virtual Machine will be created. By default, the Virtual Machine will by automatically assigned to a fault domain that best maintains balance across available fault domains. This is applicable only if the 'virtualMachineScaleSet' property of this Virtual Machine is set. The Virtual Machine Scale Set that is referenced, must have 'platformFaultDomainCount' greater than 1. This property cannot be updated once the Virtual Machine is created. Fault domain assignment can be viewed in the Virtual Machine Instance View. Minimum api‐version: 2020‐12‐01. |
priority | string | Specifies the priority for the virtual machine. Minimum api-version: 2019-03-01. Known values are: "Regular", "Low", and "Spot". (Regular, Low, Spot) |
provisioningState | string | The provisioning state, which only appears in the response. |
proximityPlacementGroup | object | SubResource. |
resiliencyProfile | object | Resiliency profile for the virtual machine. |
resources | array | The virtual machine child extension resources. |
scheduledEventsPolicy | object | Specifies Redeploy, Reboot and ScheduledEventsAdditionalPublishingTargets Scheduled Event related configurations for the virtual machine. |
scheduledEventsProfile | object | Specifies Scheduled Event related configurations. |
securityProfile | object | Specifies the Security related profile settings for the virtual machine. |
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. |
virtualMachineScaleSet | object | SubResource. |
vmId | string | Specifies the VM unique ID which is a 128-bits identifier that is encoded and stored in all Azure IaaS VMs SMBIOS and can be read using platform BIOS commands. |
zones | array | The availability 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. |
applicationProfile | object | Specifies the gallery applications that should be made available to the VM/VMSS. |
availabilitySet | object | SubResource. |
billingProfile | object | Specifies the billing related details of a Azure Spot virtual machine. Minimum api-version: 2019-03-01. |
capacityReservation | object | Specifies information about the capacity reservation that is used to allocate virtual machine. Minimum api-version: 2021-04-01. |
diagnosticsProfile | object | Specifies the boot diagnostic settings state. Minimum api-version: 2015-06-15. |
etag | string | Etag is property returned in Create/Update/Get response of the VM, so that customer can supply it in the header to ensure optimistic updates. |
evictionPolicy | string | Specifies the eviction policy for the Azure Spot virtual machine and Azure Spot scale set. For Azure Spot virtual machines, both 'Deallocate' and 'Delete' are supported and the minimum api-version is 2019-03-01. For Azure Spot scale sets, both 'Deallocate' and 'Delete' are supported and the minimum api-version is 2017-10-30-preview. Known values are: "Deallocate" and "Delete". (Deallocate, Delete) |
extendedLocation | object | The extended location of the Virtual Machine. |
extensionsTimeBudget | string | Specifies the time alloted for all extensions to start. The time duration should be between 15 minutes and 120 minutes (inclusive) and should be specified in ISO 8601 format. The default value is 90 minutes (PT1H30M). Minimum api-version: 2020-06-01. |
hardwareProfile | object | Specifies the hardware settings for the virtual machine. |
host | object | SubResource. |
hostGroup | object | SubResource. |
identity | object | The identity of the virtual machine, if configured. |
instanceView | object | The virtual machine instance view. |
interconnectBlockProfile | object | Specifies information about the Interconnect Block that is used to allocate the Virtual Machine. Minimum api-version: 2026-03-01. |
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. |
managedBy | string | ManagedBy is set to Virtual Machine Scale Set(VMSS) flex ARM resourceID, if the VM is part of the VMSS. This property is used by platform for internal resource group delete optimization. |
networkProfile | object | Specifies the network interfaces of the virtual machine. |
osProfile | object | Specifies the operating system settings used while creating the virtual machine. Some of the settings cannot be changed once VM is provisioned. |
placement | object | Placement section specifies the user-defined constraints for virtual machine hardware placement. This property cannot be changed once VM is provisioned. Minimum api-version: 2024-11-01. |
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. |
platformFaultDomain | integer | Specifies the scale set logical fault domain into which the Virtual Machine will be created. By default, the Virtual Machine will by automatically assigned to a fault domain that best maintains balance across available fault domains. This is applicable only if the 'virtualMachineScaleSet' property of this Virtual Machine is set. The Virtual Machine Scale Set that is referenced, must have 'platformFaultDomainCount' greater than 1. This property cannot be updated once the Virtual Machine is created. Fault domain assignment can be viewed in the Virtual Machine Instance View. Minimum api‐version: 2020‐12‐01. |
priority | string | Specifies the priority for the virtual machine. Minimum api-version: 2019-03-01. Known values are: "Regular", "Low", and "Spot". (Regular, Low, Spot) |
provisioningState | string | The provisioning state, which only appears in the response. |
proximityPlacementGroup | object | SubResource. |
resiliencyProfile | object | Resiliency profile for the virtual machine. |
resources | array | The virtual machine child extension resources. |
scheduledEventsPolicy | object | Specifies Redeploy, Reboot and ScheduledEventsAdditionalPublishingTargets Scheduled Event related configurations for the virtual machine. |
scheduledEventsProfile | object | Specifies Scheduled Event related configurations. |
securityProfile | object | Specifies the Security related profile settings for the virtual machine. |
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. |
virtualMachineScaleSet | object | SubResource. |
vmId | string | Specifies the VM unique ID which is a 128-bits identifier that is encoded and stored in all Azure IaaS VMs SMBIOS and can be read using platform BIOS commands. |
zones | array | The availability 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. |
applicationProfile | object | Specifies the gallery applications that should be made available to the VM/VMSS. |
availabilitySet | object | SubResource. |
billingProfile | object | Specifies the billing related details of a Azure Spot virtual machine. Minimum api-version: 2019-03-01. |
capacityReservation | object | Specifies information about the capacity reservation that is used to allocate virtual machine. Minimum api-version: 2021-04-01. |
diagnosticsProfile | object | Specifies the boot diagnostic settings state. Minimum api-version: 2015-06-15. |
etag | string | Etag is property returned in Create/Update/Get response of the VM, so that customer can supply it in the header to ensure optimistic updates. |
evictionPolicy | string | Specifies the eviction policy for the Azure Spot virtual machine and Azure Spot scale set. For Azure Spot virtual machines, both 'Deallocate' and 'Delete' are supported and the minimum api-version is 2019-03-01. For Azure Spot scale sets, both 'Deallocate' and 'Delete' are supported and the minimum api-version is 2017-10-30-preview. Known values are: "Deallocate" and "Delete". (Deallocate, Delete) |
extendedLocation | object | The extended location of the Virtual Machine. |
extensionsTimeBudget | string | Specifies the time alloted for all extensions to start. The time duration should be between 15 minutes and 120 minutes (inclusive) and should be specified in ISO 8601 format. The default value is 90 minutes (PT1H30M). Minimum api-version: 2020-06-01. |
hardwareProfile | object | Specifies the hardware settings for the virtual machine. |
host | object | SubResource. |
hostGroup | object | SubResource. |
identity | object | The identity of the virtual machine, if configured. |
instanceView | object | The virtual machine instance view. |
interconnectBlockProfile | object | Specifies information about the Interconnect Block that is used to allocate the Virtual Machine. Minimum api-version: 2026-03-01. |
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. |
managedBy | string | ManagedBy is set to Virtual Machine Scale Set(VMSS) flex ARM resourceID, if the VM is part of the VMSS. This property is used by platform for internal resource group delete optimization. |
networkProfile | object | Specifies the network interfaces of the virtual machine. |
osProfile | object | Specifies the operating system settings used while creating the virtual machine. Some of the settings cannot be changed once VM is provisioned. |
placement | object | Placement section specifies the user-defined constraints for virtual machine hardware placement. This property cannot be changed once VM is provisioned. Minimum api-version: 2024-11-01. |
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. |
platformFaultDomain | integer | Specifies the scale set logical fault domain into which the Virtual Machine will be created. By default, the Virtual Machine will by automatically assigned to a fault domain that best maintains balance across available fault domains. This is applicable only if the 'virtualMachineScaleSet' property of this Virtual Machine is set. The Virtual Machine Scale Set that is referenced, must have 'platformFaultDomainCount' greater than 1. This property cannot be updated once the Virtual Machine is created. Fault domain assignment can be viewed in the Virtual Machine Instance View. Minimum api‐version: 2020‐12‐01. |
priority | string | Specifies the priority for the virtual machine. Minimum api-version: 2019-03-01. Known values are: "Regular", "Low", and "Spot". (Regular, Low, Spot) |
provisioningState | string | The provisioning state, which only appears in the response. |
proximityPlacementGroup | object | SubResource. |
resiliencyProfile | object | Resiliency profile for the virtual machine. |
resources | array | The virtual machine child extension resources. |
scheduledEventsPolicy | object | Specifies Redeploy, Reboot and ScheduledEventsAdditionalPublishingTargets Scheduled Event related configurations for the virtual machine. |
scheduledEventsProfile | object | Specifies Scheduled Event related configurations. |
securityProfile | object | Specifies the Security related profile settings for the virtual machine. |
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. |
virtualMachineScaleSet | object | SubResource. |
vmId | string | Specifies the VM unique ID which is a 128-bits identifier that is encoded and stored in all Azure IaaS VMs SMBIOS and can be read using platform BIOS commands. |
zones | array | The availability 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. |
applicationProfile | object | Specifies the gallery applications that should be made available to the VM/VMSS. |
availabilitySet | object | SubResource. |
billingProfile | object | Specifies the billing related details of a Azure Spot virtual machine. Minimum api-version: 2019-03-01. |
capacityReservation | object | Specifies information about the capacity reservation that is used to allocate virtual machine. Minimum api-version: 2021-04-01. |
diagnosticsProfile | object | Specifies the boot diagnostic settings state. Minimum api-version: 2015-06-15. |
etag | string | Etag is property returned in Create/Update/Get response of the VM, so that customer can supply it in the header to ensure optimistic updates. |
evictionPolicy | string | Specifies the eviction policy for the Azure Spot virtual machine and Azure Spot scale set. For Azure Spot virtual machines, both 'Deallocate' and 'Delete' are supported and the minimum api-version is 2019-03-01. For Azure Spot scale sets, both 'Deallocate' and 'Delete' are supported and the minimum api-version is 2017-10-30-preview. Known values are: "Deallocate" and "Delete". (Deallocate, Delete) |
extendedLocation | object | The extended location of the Virtual Machine. |
extensionsTimeBudget | string | Specifies the time alloted for all extensions to start. The time duration should be between 15 minutes and 120 minutes (inclusive) and should be specified in ISO 8601 format. The default value is 90 minutes (PT1H30M). Minimum api-version: 2020-06-01. |
hardwareProfile | object | Specifies the hardware settings for the virtual machine. |
host | object | SubResource. |
hostGroup | object | SubResource. |
identity | object | The identity of the virtual machine, if configured. |
instanceView | object | The virtual machine instance view. |
interconnectBlockProfile | object | Specifies information about the Interconnect Block that is used to allocate the Virtual Machine. Minimum api-version: 2026-03-01. |
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. |
managedBy | string | ManagedBy is set to Virtual Machine Scale Set(VMSS) flex ARM resourceID, if the VM is part of the VMSS. This property is used by platform for internal resource group delete optimization. |
networkProfile | object | Specifies the network interfaces of the virtual machine. |
osProfile | object | Specifies the operating system settings used while creating the virtual machine. Some of the settings cannot be changed once VM is provisioned. |
placement | object | Placement section specifies the user-defined constraints for virtual machine hardware placement. This property cannot be changed once VM is provisioned. Minimum api-version: 2024-11-01. |
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. |
platformFaultDomain | integer | Specifies the scale set logical fault domain into which the Virtual Machine will be created. By default, the Virtual Machine will by automatically assigned to a fault domain that best maintains balance across available fault domains. This is applicable only if the 'virtualMachineScaleSet' property of this Virtual Machine is set. The Virtual Machine Scale Set that is referenced, must have 'platformFaultDomainCount' greater than 1. This property cannot be updated once the Virtual Machine is created. Fault domain assignment can be viewed in the Virtual Machine Instance View. Minimum api‐version: 2020‐12‐01. |
priority | string | Specifies the priority for the virtual machine. Minimum api-version: 2019-03-01. Known values are: "Regular", "Low", and "Spot". (Regular, Low, Spot) |
provisioningState | string | The provisioning state, which only appears in the response. |
proximityPlacementGroup | object | SubResource. |
resiliencyProfile | object | Resiliency profile for the virtual machine. |
resources | array | The virtual machine child extension resources. |
scheduledEventsPolicy | object | Specifies Redeploy, Reboot and ScheduledEventsAdditionalPublishingTargets Scheduled Event related configurations for the virtual machine. |
scheduledEventsProfile | object | Specifies Scheduled Event related configurations. |
securityProfile | object | Specifies the Security related profile settings for the virtual machine. |
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. |
virtualMachineScaleSet | object | SubResource. |
vmId | string | Specifies the VM unique ID which is a 128-bits identifier that is encoded and stored in all Azure IaaS VMs SMBIOS and can be read using platform BIOS commands. |
zones | array | The availability zones. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | resource_group_name, vm_name, subscription_id | $expand | Retrieves information about the model view or the instance view of a virtual machine. |
list | select | resource_group_name, subscription_id | $filter, $expand | Lists all of the virtual machines in the specified resource group. Use the nextLink property in the response to get the next page of virtual machines. |
list_by_location | select | location, subscription_id | Gets all the virtual machines under the specified subscription for the specified location. | |
list_all | select | subscription_id | statusOnly, $filter, $expand | Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response to get the next page of virtual machines. |
create_or_update | insert | resource_group_name, vm_name, subscription_id, location | The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. | |
update | update | resource_group_name, vm_name, subscription_id | The operation to update a virtual machine. | |
create_or_update | replace | resource_group_name, vm_name, subscription_id, location | The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. | |
delete | delete | resource_group_name, vm_name, subscription_id | forceDeletion | The operation to delete a virtual machine. |
list_available_sizes | exec | resource_group_name, vm_name, subscription_id | Lists all available virtual machine sizes to which the specified virtual machine can be resized. | |
assess_patches | exec | resource_group_name, vm_name, subscription_id | Assess patches on the VM. | |
attach_detach_data_disks | exec | resource_group_name, vm_name, subscription_id | Attach and detach data disks to/from the virtual machine. | |
capture | exec | resource_group_name, vm_name, subscription_id, vhdPrefix, destinationContainerName, overwriteVhds | Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar VMs. | |
convert_to_managed_disks | exec | resource_group_name, vm_name, subscription_id | Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before invoking this operation. | |
deallocate | exec | resource_group_name, vm_name, subscription_id | hibernate, forceDeallocate | Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources that this virtual machine uses. |
generalize | exec | resource_group_name, vm_name, subscription_id | Sets the OS state of the virtual machine to generalized. It is recommended to sysprep the virtual machine before performing this operation. For Windows, please refer to Create a managed image of a generalized VM in Azure . For Linux, please refer to How to create an image of a virtual machine or VHD . | |
install_patches | exec | resource_group_name, vm_name, subscription_id, rebootSetting | Installs patches on the VM. | |
instance_view | exec | resource_group_name, vm_name, subscription_id | Retrieves information about the run-time state of a virtual machine. | |
perform_maintenance | exec | resource_group_name, vm_name, subscription_id | The operation to perform maintenance on a virtual machine. | |
power_off | exec | resource_group_name, vm_name, subscription_id | skipShutdown | The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same provisioned resources. You are still charged for this virtual machine. |
reapply | exec | resource_group_name, vm_name, subscription_id | The operation to reapply a virtual machine's state. | |
redeploy | exec | resource_group_name, vm_name, subscription_id | Shuts down the virtual machine, moves it to a new node, and powers it back on. | |
reimage | exec | resource_group_name, vm_name, subscription_id | Reimages (upgrade the operating system) a virtual machine 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. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should be updated accordingly before performing the reimage. | |
restart | exec | resource_group_name, vm_name, subscription_id | The operation to restart a virtual machine. | |
retrieve_boot_diagnostics_data | exec | resource_group_name, vm_name, subscription_id | sasUriExpirationTimeInMinutes | The operation to retrieve SAS URIs for a virtual machine's boot diagnostic logs. |
simulate_eviction | exec | resource_group_name, vm_name, subscription_id | The operation to simulate the eviction of spot virtual machine. | |
start | exec | resource_group_name, vm_name, subscription_id | The operation to start a virtual machine. | |
run_command | exec | resource_group_name, vm_name, subscription_id, commandId | Run command on the VM. | |
migrate_to_vm_scale_set | exec | resource_group_name, vm_name, subscription_id | Migrate a virtual machine from availability set to Flexible Virtual Machine 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 |
|---|---|---|
location | string | The location name. Required. |
resource_group_name | string | The name of the resource group. The name is case insensitive. Required. |
subscription_id | string | |
vm_name | string | The name of the virtual machine. Required. |
$expand | string | The expand expression to apply on operation. 'instanceView' enables fetching run time status of all Virtual Machines, this can only be specified if a valid $filter option is specified. "instanceView" Default value is None. |
$filter | string | The system query option to filter VMs returned in the response. Allowed value is 'virtualMachineScaleSet/id' eq /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}'. Default value is None. |
forceDeallocate | boolean | Optional parameter to force deallocate a virtual machine. Default is false. Default value is None. |
forceDeletion | boolean | Optional parameter to force delete virtual machines. Default value is None. |
hibernate | boolean | Optional parameter to hibernate a virtual machine. 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. |
statusOnly | string | statusOnly=true enables fetching run time status of all Virtual Machines in the subscription. Default value is None. |
SELECT examples
- get
- list
- list_by_location
- list_all
Retrieves information about the model view or the instance view of a virtual machine.
SELECT
id,
name,
additionalCapabilities,
applicationProfile,
availabilitySet,
billingProfile,
capacityReservation,
diagnosticsProfile,
etag,
evictionPolicy,
extendedLocation,
extensionsTimeBudget,
hardwareProfile,
host,
hostGroup,
identity,
instanceView,
interconnectBlockProfile,
licenseType,
location,
managedBy,
networkProfile,
osProfile,
placement,
plan,
platformFaultDomain,
priority,
provisioningState,
proximityPlacementGroup,
resiliencyProfile,
resources,
scheduledEventsPolicy,
scheduledEventsProfile,
securityProfile,
storageProfile,
systemData,
tags,
timeCreated,
type,
userData,
virtualMachineScaleSet,
vmId,
zones
FROM azure.compute.virtual_machines
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND vm_name = '{{ vm_name }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
AND $expand = '{{ $expand }}'
;
Lists all of the virtual machines in the specified resource group. Use the nextLink property in the response to get the next page of virtual machines.
SELECT
id,
name,
additionalCapabilities,
applicationProfile,
availabilitySet,
billingProfile,
capacityReservation,
diagnosticsProfile,
etag,
evictionPolicy,
extendedLocation,
extensionsTimeBudget,
hardwareProfile,
host,
hostGroup,
identity,
instanceView,
interconnectBlockProfile,
licenseType,
location,
managedBy,
networkProfile,
osProfile,
placement,
plan,
platformFaultDomain,
priority,
provisioningState,
proximityPlacementGroup,
resiliencyProfile,
resources,
scheduledEventsPolicy,
scheduledEventsProfile,
securityProfile,
storageProfile,
systemData,
tags,
timeCreated,
type,
userData,
virtualMachineScaleSet,
vmId,
zones
FROM azure.compute.virtual_machines
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
AND $filter = '{{ $filter }}'
AND $expand = '{{ $expand }}'
;
Gets all the virtual machines under the specified subscription for the specified location.
SELECT
id,
name,
additionalCapabilities,
applicationProfile,
availabilitySet,
billingProfile,
capacityReservation,
diagnosticsProfile,
etag,
evictionPolicy,
extendedLocation,
extensionsTimeBudget,
hardwareProfile,
host,
hostGroup,
identity,
instanceView,
interconnectBlockProfile,
licenseType,
location,
managedBy,
networkProfile,
osProfile,
placement,
plan,
platformFaultDomain,
priority,
provisioningState,
proximityPlacementGroup,
resiliencyProfile,
resources,
scheduledEventsPolicy,
scheduledEventsProfile,
securityProfile,
storageProfile,
systemData,
tags,
timeCreated,
type,
userData,
virtualMachineScaleSet,
vmId,
zones
FROM azure.compute.virtual_machines
WHERE location = '{{ location }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
;
Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response to get the next page of virtual machines.
SELECT
id,
name,
additionalCapabilities,
applicationProfile,
availabilitySet,
billingProfile,
capacityReservation,
diagnosticsProfile,
etag,
evictionPolicy,
extendedLocation,
extensionsTimeBudget,
hardwareProfile,
host,
hostGroup,
identity,
instanceView,
interconnectBlockProfile,
licenseType,
location,
managedBy,
networkProfile,
osProfile,
placement,
plan,
platformFaultDomain,
priority,
provisioningState,
proximityPlacementGroup,
resiliencyProfile,
resources,
scheduledEventsPolicy,
scheduledEventsProfile,
securityProfile,
storageProfile,
systemData,
tags,
timeCreated,
type,
userData,
virtualMachineScaleSet,
vmId,
zones
FROM azure.compute.virtual_machines
WHERE subscription_id = '{{ subscription_id }}' -- required
AND statusOnly = '{{ statusOnly }}'
AND $filter = '{{ $filter }}'
AND $expand = '{{ $expand }}'
;
INSERT examples
- create_or_update
- Manifest
The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation.
INSERT INTO azure.compute.virtual_machines (
tags,
location,
properties,
plan,
identity,
zones,
extendedLocation,
placement,
resource_group_name,
vm_name,
subscription_id
)
SELECT
'{{ tags }}',
'{{ location }}' /* required */,
'{{ properties }}',
'{{ plan }}',
'{{ identity }}',
'{{ zones }}',
'{{ extendedLocation }}',
'{{ placement }}',
'{{ resource_group_name }}',
'{{ vm_name }}',
'{{ subscription_id }}'
RETURNING
id,
name,
etag,
extendedLocation,
identity,
location,
managedBy,
placement,
plan,
properties,
resources,
systemData,
tags,
type,
zones
;
# Description fields are for documentation purposes
- name: virtual_machines
props:
- name: resource_group_name
value: "{{ resource_group_name }}"
description: Required parameter for the virtual_machines resource.
- name: vm_name
value: "{{ vm_name }}"
description: Required parameter for the virtual_machines resource.
- name: subscription_id
value: "{{ subscription_id }}"
description: Required parameter for the virtual_machines resource.
- name: tags
value: "{{ tags }}"
description: |
Resource tags.
- name: location
value: "{{ location }}"
description: |
The geo-location where the resource lives. Required.
- name: properties
description: |
Describes the properties of a Virtual Machine.
value:
hardwareProfile:
vmSize: "{{ vmSize }}"
vmSizeProperties:
vCPUsAvailable: {{ vCPUsAvailable }}
vCPUsPerCore: {{ vCPUsPerCore }}
scheduledEventsPolicy:
userInitiatedRedeploy:
automaticallyApprove: {{ automaticallyApprove }}
userInitiatedReboot:
automaticallyApprove: {{ automaticallyApprove }}
scheduledEventsAdditionalPublishingTargets:
eventGridAndResourceGraph:
enable: {{ enable }}
scheduledEventsApiVersion: "{{ scheduledEventsApiVersion }}"
allInstancesDown:
automaticallyApprove: {{ automaticallyApprove }}
storageProfile:
imageReference:
id: "{{ id }}"
publisher: "{{ publisher }}"
offer: "{{ offer }}"
sku: "{{ sku }}"
version: "{{ version }}"
exactVersion: "{{ exactVersion }}"
sharedGalleryImageId: "{{ sharedGalleryImageId }}"
communityGalleryImageId: "{{ communityGalleryImageId }}"
osDisk:
osType: "{{ osType }}"
encryptionSettings:
diskEncryptionKey:
secretUrl: "{{ secretUrl }}"
sourceVault: "{{ sourceVault }}"
keyEncryptionKey:
keyUrl: "{{ keyUrl }}"
sourceVault: "{{ sourceVault }}"
enabled: {{ enabled }}
name: "{{ name }}"
vhd:
uri: "{{ uri }}"
image:
uri: "{{ uri }}"
caching: "{{ caching }}"
writeAcceleratorEnabled: {{ writeAcceleratorEnabled }}
diffDiskSettings:
option: "{{ option }}"
placement: "{{ placement }}"
enableFullCaching: {{ enableFullCaching }}
createOption: "{{ createOption }}"
diskSizeGB: {{ diskSizeGB }}
storageFaultDomainAlignment: "{{ storageFaultDomainAlignment }}"
managedDisk:
id: "{{ id }}"
storageAccountType: "{{ storageAccountType }}"
diskEncryptionSet:
id: "{{ id }}"
securityProfile:
securityEncryptionType: "{{ securityEncryptionType }}"
diskEncryptionSet: "{{ diskEncryptionSet }}"
deleteOption: "{{ deleteOption }}"
dataDisks:
- lun: {{ lun }}
name: "{{ name }}"
vhd:
uri: "{{ uri }}"
image:
uri: "{{ uri }}"
caching: "{{ caching }}"
writeAcceleratorEnabled: {{ writeAcceleratorEnabled }}
createOption: "{{ createOption }}"
diskSizeGB: {{ diskSizeGB }}
storageFaultDomainAlignment: "{{ storageFaultDomainAlignment }}"
managedDisk:
id: "{{ id }}"
storageAccountType: "{{ storageAccountType }}"
diskEncryptionSet:
id: "{{ id }}"
securityProfile:
securityEncryptionType: "{{ securityEncryptionType }}"
diskEncryptionSet: "{{ diskEncryptionSet }}"
sourceResource:
id: "{{ id }}"
toBeDetached: {{ toBeDetached }}
diskIOPSReadWrite: {{ diskIOPSReadWrite }}
diskMBpsReadWrite: {{ diskMBpsReadWrite }}
detachOption: "{{ detachOption }}"
deleteOption: "{{ deleteOption }}"
diskControllerType: "{{ diskControllerType }}"
alignRegionalDisksToVMZone: {{ alignRegionalDisksToVMZone }}
additionalCapabilities:
ultraSSDEnabled: {{ ultraSSDEnabled }}
hibernationEnabled: {{ hibernationEnabled }}
enableFips1403Encryption: {{ enableFips1403Encryption }}
osProfile:
computerName: "{{ computerName }}"
adminUsername: "{{ adminUsername }}"
adminPassword: "{{ adminPassword }}"
customData: "{{ customData }}"
windowsConfiguration:
provisionVMAgent: {{ provisionVMAgent }}
enableAutomaticUpdates: {{ enableAutomaticUpdates }}
timeZone: "{{ timeZone }}"
additionalUnattendContent:
- passName: "{{ passName }}"
componentName: "{{ componentName }}"
settingName: "{{ settingName }}"
content: "{{ content }}"
patchSettings:
patchMode: "{{ patchMode }}"
enableHotpatching: {{ enableHotpatching }}
assessmentMode: "{{ assessmentMode }}"
automaticByPlatformSettings:
rebootSetting: "{{ rebootSetting }}"
bypassPlatformSafetyChecksOnUserSchedule: {{ bypassPlatformSafetyChecksOnUserSchedule }}
winRM:
listeners:
- protocol: "{{ protocol }}"
certificateUrl: "{{ certificateUrl }}"
enableVMAgentPlatformUpdates: {{ enableVMAgentPlatformUpdates }}
linuxConfiguration:
disablePasswordAuthentication: {{ disablePasswordAuthentication }}
ssh:
publicKeys:
- path: "{{ path }}"
keyData: "{{ keyData }}"
provisionVMAgent: {{ provisionVMAgent }}
patchSettings:
patchMode: "{{ patchMode }}"
assessmentMode: "{{ assessmentMode }}"
automaticByPlatformSettings:
rebootSetting: "{{ rebootSetting }}"
bypassPlatformSafetyChecksOnUserSchedule: {{ bypassPlatformSafetyChecksOnUserSchedule }}
enableVMAgentPlatformUpdates: {{ enableVMAgentPlatformUpdates }}
secrets:
- sourceVault:
id: "{{ id }}"
vaultCertificates: "{{ vaultCertificates }}"
allowExtensionOperations: {{ allowExtensionOperations }}
requireGuestProvisionSignal: {{ requireGuestProvisionSignal }}
networkProfile:
networkInterfaces:
- id: "{{ id }}"
properties:
primary: {{ primary }}
deleteOption: "{{ deleteOption }}"
networkApiVersion: "{{ networkApiVersion }}"
networkInterfaceConfigurations:
- name: "{{ name }}"
properties:
primary: {{ primary }}
deleteOption: "{{ deleteOption }}"
enableAcceleratedNetworking: {{ enableAcceleratedNetworking }}
disableTcpStateTracking: {{ disableTcpStateTracking }}
enableFpga: {{ enableFpga }}
enableIPForwarding: {{ enableIPForwarding }}
networkSecurityGroup:
id: "{{ id }}"
dnsSettings:
dnsServers: "{{ dnsServers }}"
ipConfigurations:
- name: "{{ name }}"
properties:
subnet: "{{ subnet }}"
primary: {{ primary }}
publicIPAddressConfiguration: "{{ publicIPAddressConfiguration }}"
privateIPAddressVersion: "{{ privateIPAddressVersion }}"
applicationSecurityGroups: "{{ applicationSecurityGroups }}"
applicationGatewayBackendAddressPools: "{{ applicationGatewayBackendAddressPools }}"
loadBalancerBackendAddressPools: "{{ loadBalancerBackendAddressPools }}"
dscpConfiguration:
id: "{{ id }}"
auxiliaryMode: "{{ auxiliaryMode }}"
auxiliarySku: "{{ auxiliarySku }}"
tags: "{{ tags }}"
interconnectGroupProfile:
interconnectGroup:
id: "{{ id }}"
subgroups:
- id: "{{ id }}"
securityProfile:
uefiSettings:
secureBootEnabled: {{ secureBootEnabled }}
vTpmEnabled: {{ vTpmEnabled }}
encryptionAtHost: {{ encryptionAtHost }}
securityType: "{{ securityType }}"
encryptionIdentity:
userAssignedIdentityResourceId: "{{ userAssignedIdentityResourceId }}"
proxyAgentSettings:
enabled: {{ enabled }}
mode: "{{ mode }}"
keyIncarnationId: {{ keyIncarnationId }}
wireServer:
mode: "{{ mode }}"
inVMAccessControlProfileReferenceId: "{{ inVMAccessControlProfileReferenceId }}"
imds:
mode: "{{ mode }}"
inVMAccessControlProfileReferenceId: "{{ inVMAccessControlProfileReferenceId }}"
addProxyAgentExtension: {{ addProxyAgentExtension }}
diagnosticsProfile:
bootDiagnostics:
enabled: {{ enabled }}
storageUri: "{{ storageUri }}"
availabilitySet:
id: "{{ id }}"
virtualMachineScaleSet:
id: "{{ id }}"
proximityPlacementGroup:
id: "{{ id }}"
priority: "{{ priority }}"
evictionPolicy: "{{ evictionPolicy }}"
billingProfile:
maxPrice: {{ maxPrice }}
host:
id: "{{ id }}"
hostGroup:
id: "{{ id }}"
provisioningState: "{{ provisioningState }}"
instanceView:
platformUpdateDomain: {{ platformUpdateDomain }}
platformFaultDomain: {{ platformFaultDomain }}
computerName: "{{ computerName }}"
osName: "{{ osName }}"
osVersion: "{{ osVersion }}"
hyperVGeneration: "{{ hyperVGeneration }}"
rdpThumbPrint: "{{ rdpThumbPrint }}"
vmAgent:
vmAgentVersion: "{{ vmAgentVersion }}"
extensionHandlers:
- type: "{{ type }}"
typeHandlerVersion: "{{ typeHandlerVersion }}"
status:
code: "{{ code }}"
level: "{{ level }}"
displayStatus: "{{ displayStatus }}"
message: "{{ message }}"
time: "{{ time }}"
statuses:
- code: "{{ code }}"
level: "{{ level }}"
displayStatus: "{{ displayStatus }}"
message: "{{ message }}"
time: "{{ time }}"
maintenanceRedeployStatus:
isCustomerInitiatedMaintenanceAllowed: {{ isCustomerInitiatedMaintenanceAllowed }}
preMaintenanceWindowStartTime: "{{ preMaintenanceWindowStartTime }}"
preMaintenanceWindowEndTime: "{{ preMaintenanceWindowEndTime }}"
maintenanceWindowStartTime: "{{ maintenanceWindowStartTime }}"
maintenanceWindowEndTime: "{{ maintenanceWindowEndTime }}"
lastOperationResultCode: "{{ lastOperationResultCode }}"
lastOperationMessage: "{{ lastOperationMessage }}"
disks:
- name: "{{ name }}"
encryptionSettings: "{{ encryptionSettings }}"
statuses: "{{ statuses }}"
storageAlignmentStatus: "{{ storageAlignmentStatus }}"
extensions:
- name: "{{ name }}"
type: "{{ type }}"
typeHandlerVersion: "{{ typeHandlerVersion }}"
substatuses: "{{ substatuses }}"
statuses: "{{ statuses }}"
vmHealth:
status:
code: "{{ code }}"
level: "{{ level }}"
displayStatus: "{{ displayStatus }}"
message: "{{ message }}"
time: "{{ time }}"
bootDiagnostics:
consoleScreenshotBlobUri: "{{ consoleScreenshotBlobUri }}"
serialConsoleLogBlobUri: "{{ serialConsoleLogBlobUri }}"
status:
code: "{{ code }}"
level: "{{ level }}"
displayStatus: "{{ displayStatus }}"
message: "{{ message }}"
time: "{{ time }}"
assignedHost: "{{ assignedHost }}"
statuses:
- code: "{{ code }}"
level: "{{ level }}"
displayStatus: "{{ displayStatus }}"
message: "{{ message }}"
time: "{{ time }}"
patchStatus:
availablePatchSummary:
status: "{{ status }}"
assessmentActivityId: "{{ assessmentActivityId }}"
rebootPending: {{ rebootPending }}
criticalAndSecurityPatchCount: {{ criticalAndSecurityPatchCount }}
otherPatchCount: {{ otherPatchCount }}
startTime: "{{ startTime }}"
lastModifiedTime: "{{ lastModifiedTime }}"
error:
details: "{{ details }}"
innererror: "{{ innererror }}"
code: "{{ code }}"
target: "{{ target }}"
message: "{{ message }}"
lastPatchInstallationSummary:
status: "{{ status }}"
installationActivityId: "{{ installationActivityId }}"
maintenanceWindowExceeded: {{ maintenanceWindowExceeded }}
notSelectedPatchCount: {{ notSelectedPatchCount }}
excludedPatchCount: {{ excludedPatchCount }}
pendingPatchCount: {{ pendingPatchCount }}
installedPatchCount: {{ installedPatchCount }}
failedPatchCount: {{ failedPatchCount }}
startTime: "{{ startTime }}"
lastModifiedTime: "{{ lastModifiedTime }}"
error:
details: "{{ details }}"
innererror: "{{ innererror }}"
code: "{{ code }}"
target: "{{ target }}"
message: "{{ message }}"
configurationStatuses:
- code: "{{ code }}"
level: "{{ level }}"
displayStatus: "{{ displayStatus }}"
message: "{{ message }}"
time: "{{ time }}"
isVMInStandbyPool: {{ isVMInStandbyPool }}
interconnectInstanceView:
interconnectSubgroupId: "{{ interconnectSubgroupId }}"
licenseType: "{{ licenseType }}"
vmId: "{{ vmId }}"
extensionsTimeBudget: "{{ extensionsTimeBudget }}"
platformFaultDomain: {{ platformFaultDomain }}
scheduledEventsProfile:
terminateNotificationProfile:
notBeforeTimeout: "{{ notBeforeTimeout }}"
enable: {{ enable }}
osImageNotificationProfile:
notBeforeTimeout: "{{ notBeforeTimeout }}"
enable: {{ enable }}
userData: "{{ userData }}"
capacityReservation:
capacityReservationGroup:
id: "{{ id }}"
interconnectBlockProfile:
interconnectBlock:
id: "{{ id }}"
applicationProfile:
galleryApplications:
- tags: "{{ tags }}"
order: {{ order }}
packageReferenceId: "{{ packageReferenceId }}"
configurationReference: "{{ configurationReference }}"
treatFailureAsDeploymentFailure: {{ treatFailureAsDeploymentFailure }}
enableAutomaticUpgrade: {{ enableAutomaticUpgrade }}
timeCreated: "{{ timeCreated }}"
resiliencyProfile:
zoneMovement:
isEnabled: {{ isEnabled }}
- name: plan
description: |
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**.
value:
name: "{{ name }}"
publisher: "{{ publisher }}"
product: "{{ product }}"
promotionCode: "{{ promotionCode }}"
- name: identity
description: |
The identity of the virtual machine, if configured.
value:
principalId: "{{ principalId }}"
tenantId: "{{ tenantId }}"
type: "{{ type }}"
userAssignedIdentities: "{{ userAssignedIdentities }}"
- name: zones
value:
- "{{ zones }}"
description: |
The availability zones.
- name: extendedLocation
description: |
The extended location of the Virtual Machine.
value:
name: "{{ name }}"
type: "{{ type }}"
- name: placement
description: |
Placement section specifies the user-defined constraints for virtual machine hardware placement. This property cannot be changed once VM is provisioned. Minimum api-version: 2024-11-01.
value:
zonePlacementPolicy: "{{ zonePlacementPolicy }}"
includeZones:
- "{{ includeZones }}"
excludeZones:
- "{{ excludeZones }}"
UPDATE examples
- update
The operation to update a virtual machine.
UPDATE azure.compute.virtual_machines
SET
tags = '{{ tags }}',
plan = '{{ plan }}',
properties = '{{ properties }}',
identity = '{{ identity }}',
zones = '{{ zones }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND vm_name = '{{ vm_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
RETURNING
id,
name,
etag,
extendedLocation,
identity,
location,
managedBy,
placement,
plan,
properties,
resources,
systemData,
tags,
type,
zones;
REPLACE examples
- create_or_update
The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation.
REPLACE azure.compute.virtual_machines
SET
tags = '{{ tags }}',
location = '{{ location }}',
properties = '{{ properties }}',
plan = '{{ plan }}',
identity = '{{ identity }}',
zones = '{{ zones }}',
extendedLocation = '{{ extendedLocation }}',
placement = '{{ placement }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND vm_name = '{{ vm_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
AND location = '{{ location }}' --required
RETURNING
id,
name,
etag,
extendedLocation,
identity,
location,
managedBy,
placement,
plan,
properties,
resources,
systemData,
tags,
type,
zones;
DELETE examples
- delete
The operation to delete a virtual machine.
DELETE FROM azure.compute.virtual_machines
WHERE resource_group_name = '{{ resource_group_name }}' --required
AND vm_name = '{{ vm_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
AND forceDeletion = '{{ forceDeletion }}'
;
Lifecycle Methods
- list_available_sizes
- assess_patches
- attach_detach_data_disks
- capture
- convert_to_managed_disks
- deallocate
- generalize
- install_patches
- instance_view
- perform_maintenance
- power_off
- reapply
- redeploy
- reimage
- restart
- retrieve_boot_diagnostics_data
- simulate_eviction
- start
- run_command
- migrate_to_vm_scale_set
Lists all available virtual machine sizes to which the specified virtual machine can be resized.
EXEC azure.compute.virtual_machines.list_available_sizes
@resource_group_name='{{ resource_group_name }}' --required,
@vm_name='{{ vm_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
;
Assess patches on the VM.
EXEC azure.compute.virtual_machines.assess_patches
@resource_group_name='{{ resource_group_name }}' --required,
@vm_name='{{ vm_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
;
Attach and detach data disks to/from the virtual machine.
EXEC azure.compute.virtual_machines.attach_detach_data_disks
@resource_group_name='{{ resource_group_name }}' --required,
@vm_name='{{ vm_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
@@json=
'{
"dataDisksToAttach": "{{ dataDisksToAttach }}",
"dataDisksToDetach": "{{ dataDisksToDetach }}"
}'
;
Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar VMs.
EXEC azure.compute.virtual_machines.capture
@resource_group_name='{{ resource_group_name }}' --required,
@vm_name='{{ vm_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
@@json=
'{
"vhdPrefix": "{{ vhdPrefix }}",
"destinationContainerName": "{{ destinationContainerName }}",
"overwriteVhds": {{ overwriteVhds }}
}'
;
Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before invoking this operation.
EXEC azure.compute.virtual_machines.convert_to_managed_disks
@resource_group_name='{{ resource_group_name }}' --required,
@vm_name='{{ vm_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
;
Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources that this virtual machine uses.
EXEC azure.compute.virtual_machines.deallocate
@resource_group_name='{{ resource_group_name }}' --required,
@vm_name='{{ vm_name }}' --required,
@subscription_id='{{ subscription_id }}' --required,
@hibernate={{ hibernate }},
@forceDeallocate={{ forceDeallocate }}
;
Sets the OS state of the virtual machine to generalized. It is recommended to sysprep the virtual machine before performing this operation. For Windows, please refer to Create a managed image of a generalized VM in Azure . For Linux, please refer to How to create an image of a virtual machine or VHD .
EXEC azure.compute.virtual_machines.generalize
@resource_group_name='{{ resource_group_name }}' --required,
@vm_name='{{ vm_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
;
Installs patches on the VM.
EXEC azure.compute.virtual_machines.install_patches
@resource_group_name='{{ resource_group_name }}' --required,
@vm_name='{{ vm_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
@@json=
'{
"maximumDuration": "{{ maximumDuration }}",
"rebootSetting": "{{ rebootSetting }}",
"windowsParameters": "{{ windowsParameters }}",
"linuxParameters": "{{ linuxParameters }}"
}'
;
Retrieves information about the run-time state of a virtual machine.
EXEC azure.compute.virtual_machines.instance_view
@resource_group_name='{{ resource_group_name }}' --required,
@vm_name='{{ vm_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
;
The operation to perform maintenance on a virtual machine.
EXEC azure.compute.virtual_machines.perform_maintenance
@resource_group_name='{{ resource_group_name }}' --required,
@vm_name='{{ vm_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
;
The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same provisioned resources. You are still charged for this virtual machine.
EXEC azure.compute.virtual_machines.power_off
@resource_group_name='{{ resource_group_name }}' --required,
@vm_name='{{ vm_name }}' --required,
@subscription_id='{{ subscription_id }}' --required,
@skipShutdown={{ skipShutdown }}
;
The operation to reapply a virtual machine's state.
EXEC azure.compute.virtual_machines.reapply
@resource_group_name='{{ resource_group_name }}' --required,
@vm_name='{{ vm_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
;
Shuts down the virtual machine, moves it to a new node, and powers it back on.
EXEC azure.compute.virtual_machines.redeploy
@resource_group_name='{{ resource_group_name }}' --required,
@vm_name='{{ vm_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
;
Reimages (upgrade the operating system) a virtual machine 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. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should be updated accordingly before performing the reimage.
EXEC azure.compute.virtual_machines.reimage
@resource_group_name='{{ resource_group_name }}' --required,
@vm_name='{{ vm_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
@@json=
'{
"tempDisk": {{ tempDisk }},
"exactVersion": "{{ exactVersion }}",
"osProfile": "{{ osProfile }}"
}'
;
The operation to restart a virtual machine.
EXEC azure.compute.virtual_machines.restart
@resource_group_name='{{ resource_group_name }}' --required,
@vm_name='{{ vm_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
;
The operation to retrieve SAS URIs for a virtual machine's boot diagnostic logs.
EXEC azure.compute.virtual_machines.retrieve_boot_diagnostics_data
@resource_group_name='{{ resource_group_name }}' --required,
@vm_name='{{ vm_name }}' --required,
@subscription_id='{{ subscription_id }}' --required,
@sasUriExpirationTimeInMinutes='{{ sasUriExpirationTimeInMinutes }}'
;
The operation to simulate the eviction of spot virtual machine.
EXEC azure.compute.virtual_machines.simulate_eviction
@resource_group_name='{{ resource_group_name }}' --required,
@vm_name='{{ vm_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
;
The operation to start a virtual machine.
EXEC azure.compute.virtual_machines.start
@resource_group_name='{{ resource_group_name }}' --required,
@vm_name='{{ vm_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
;
Run command on the VM.
EXEC azure.compute.virtual_machines.run_command
@resource_group_name='{{ resource_group_name }}' --required,
@vm_name='{{ vm_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
@@json=
'{
"commandId": "{{ commandId }}",
"script": "{{ script }}",
"parameters": "{{ parameters }}"
}'
;
Migrate a virtual machine from availability set to Flexible Virtual Machine Scale Set.
EXEC azure.compute.virtual_machines.migrate_to_vm_scale_set
@resource_group_name='{{ resource_group_name }}' --required,
@vm_name='{{ vm_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
@@json=
'{
"targetZone": "{{ targetZone }}",
"targetFaultDomain": {{ targetFaultDomain }},
"targetVMSize": "{{ targetVMSize }}"
}'
;