Skip to main content

virtual_machines

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

Overview

Namevirtual_machines
TypeResource
Idazure.compute.virtual_machines

Fields

NameDatatypeDescription
idtextResource Id
nametextResource name
additional_capabilitiestextfield from the properties object
application_profiletextfield from the properties object
availability_settextfield from the properties object
billing_profiletextfield from the properties object
capacity_reservationtextfield from the properties object
diagnostics_profiletextfield from the properties object
etagtextEtag is property returned in Create/Update/Get response of the VM, so that customer can supply it in the header to ensure optimistic updates.
eviction_policytextfield from the properties object
extended_locationtextfield from the properties object
extensions_time_budgettextfield from the properties object
hardware_profiletextfield from the properties object
hosttextfield from the properties object
host_grouptextfield from the properties object
identitytextIdentity for the virtual machine.
instance_viewtextfield from the properties object
license_typetextfield from the properties object
locationtextResource location
managed_bytextfield from the properties object
network_profiletextfield from the properties object
os_profiletextfield from the properties object
plantextSpecifies 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.
platform_fault_domaintextfield from the properties object
prioritytextfield from the properties object
provisioning_statetextfield from the properties object
proximity_placement_grouptextfield from the properties object
resourceGroupNametextfield from the properties object
resourcestextThe virtual machine child extension resources.
scheduled_events_policytextfield from the properties object
scheduled_events_profiletextfield from the properties object
security_profiletextfield from the properties object
storage_profiletextfield from the properties object
subscriptionIdtextfield from the properties object
tagstextResource tags
time_createdtextfield from the properties object
typetextResource type
user_datatextfield from the properties object
virtual_machine_scale_settextfield from the properties object
vmNametextfield from the properties object
vm_idtextfield from the properties object
zonestextThe virtual machine zones.

Methods

NameAccessible byRequired ParamsDescription
getSELECTresourceGroupName, subscriptionId, vmNameRetrieves information about the model view or the instance view of a virtual machine.
listSELECTresourceGroupName, subscriptionIdLists 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_allSELECTsubscriptionIdLists all of the virtual machines in the specified subscription. Use the nextLink property in the response to get the next page of virtual machines.
list_by_locationSELECTlocation, subscriptionIdGets all the virtual machines under the specified subscription for the specified location.
create_or_updateINSERTresourceGroupName, subscriptionId, vmNameThe operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation.
deleteDELETEresourceGroupName, subscriptionId, vmNameThe operation to delete a virtual machine.
updateUPDATEresourceGroupName, subscriptionId, vmNameThe operation to update a virtual machine.
assess_patchesEXECresourceGroupName, subscriptionId, vmNameAssess patches on the VM.
attach_detach_data_disksEXECresourceGroupName, subscriptionId, vmNameAttach and detach data disks to/from the virtual machine.
captureEXECresourceGroupName, subscriptionId, vmName, data__destinationContainerName, data__overwriteVhds, data__vhdPrefixCaptures 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_disksEXECresourceGroupName, subscriptionId, vmNameConverts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before invoking this operation.
deallocateEXECresourceGroupName, subscriptionId, vmNameShuts down the virtual machine and releases the compute resources. You are not billed for the compute resources that this virtual machine uses.
generalizeEXECresourceGroupName, subscriptionId, vmNameSets 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_patchesEXECresourceGroupName, subscriptionId, vmName, data__rebootSettingInstalls patches on the VM.
instance_viewEXECresourceGroupName, subscriptionId, vmNameRetrieves information about the run-time state of a virtual machine.
perform_maintenanceEXECresourceGroupName, subscriptionId, vmNameThe operation to perform maintenance on a virtual machine.
power_offEXECresourceGroupName, subscriptionId, vmNameThe 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.
reapplyEXECresourceGroupName, subscriptionId, vmNameThe operation to reapply a virtual machine's state.
redeployEXECresourceGroupName, subscriptionId, vmNameShuts down the virtual machine, moves it to a new node, and powers it back on.
reimageEXECresourceGroupName, subscriptionId, vmNameReimages (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.
restartEXECresourceGroupName, subscriptionId, vmNameThe operation to restart a virtual machine.
retrieve_boot_diagnostics_dataEXECresourceGroupName, subscriptionId, vmNameThe operation to retrieve SAS URIs for a virtual machine's boot diagnostic logs.
run_commandEXECresourceGroupName, subscriptionId, vmName, data__commandIdRun command on the VM.
simulate_evictionEXECresourceGroupName, subscriptionId, vmNameThe operation to simulate the eviction of spot virtual machine.
startEXECresourceGroupName, subscriptionId, vmNameThe operation to start a virtual machine.

SELECT examples

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,
additional_capabilities,
application_profile,
availability_set,
billing_profile,
capacity_reservation,
diagnostics_profile,
etag,
eviction_policy,
extended_location,
extensions_time_budget,
hardware_profile,
host,
host_group,
identity,
instance_view,
license_type,
location,
managed_by,
network_profile,
os_profile,
plan,
platform_fault_domain,
priority,
provisioning_state,
proximity_placement_group,
resourceGroupName,
resources,
scheduled_events_policy,
scheduled_events_profile,
security_profile,
storage_profile,
subscriptionId,
tags,
time_created,
type,
user_data,
virtual_machine_scale_set,
vmName,
vm_id,
zones
FROM azure.compute.vw_virtual_machines
WHERE subscriptionId = '{{ subscriptionId }}';

INSERT example

Use the following StackQL query and manifest file to create a new virtual_machines resource.

/*+ create */
INSERT INTO azure.compute.virtual_machines (
resourceGroupName,
subscriptionId,
vmName,
plan,
properties,
identity,
zones,
extendedLocation,
location,
tags
)
SELECT
'{{ resourceGroupName }}',
'{{ subscriptionId }}',
'{{ vmName }}',
'{{ plan }}',
'{{ properties }}',
'{{ identity }}',
'{{ zones }}',
'{{ extendedLocation }}',
'{{ location }}',
'{{ tags }}'
;

UPDATE example

Updates a virtual_machines resource.

/*+ update */
UPDATE azure.compute.virtual_machines
SET
plan = '{{ plan }}',
properties = '{{ properties }}',
identity = '{{ identity }}',
zones = '{{ zones }}',
tags = '{{ tags }}'
WHERE
resourceGroupName = '{{ resourceGroupName }}'
AND subscriptionId = '{{ subscriptionId }}'
AND vmName = '{{ vmName }}';

DELETE example

Deletes the specified virtual_machines resource.

/*+ delete */
DELETE FROM azure.compute.virtual_machines
WHERE resourceGroupName = '{{ resourceGroupName }}'
AND subscriptionId = '{{ subscriptionId }}'
AND vmName = '{{ vmName }}';