Skip to main content

virtual_machines

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

Overview

Namevirtual_machines
TypeResource
Idazure.nexus.virtual_machines

Fields

The following fields are returned by SELECT queries:

The resource has been successfully retrieved.

NameDatatypeDescription
extendedLocationobjectThe extended location of the cluster associated with the resource. (title: ExtendedLocation represents the Azure custom location where the resource will be created.)
locationstringThe geo-location where the resource lives
propertiesobjectThe list of the resource properties. (title: VirtualMachineProperties represents the properties of the virtual machine.)
tagsobjectResource tags.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectsubscriptionId, resourceGroupName, virtualMachineNameGet properties of the provided virtual machine.
list_by_resource_groupselectsubscriptionId, resourceGroupNameGet a list of virtual machines in the provided resource group.
list_by_subscriptionselectsubscriptionIdGet a list of virtual machines in the provided subscription.
create_or_updateinsertsubscriptionId, resourceGroupName, virtualMachineName, data__extendedLocation, data__propertiesCreate a new virtual machine or update the properties of the existing virtual machine.
updateupdatesubscriptionId, resourceGroupName, virtualMachineNamePatch the properties of the provided virtual machine, or update the tags associated with the virtual machine. Properties and tag updates can be done independently.
deletedeletesubscriptionId, resourceGroupName, virtualMachineNameDelete the provided virtual machine.
power_offexecsubscriptionId, resourceGroupName, virtualMachineNamePower off the provided virtual machine.
reimageexecsubscriptionId, resourceGroupName, virtualMachineNameReimage the provided virtual machine.
restartexecsubscriptionId, resourceGroupName, virtualMachineNameRestart the provided virtual machine.
startexecsubscriptionId, resourceGroupName, virtualMachineNameStart the provided virtual machine.

Parameters

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

NameDatatypeDescription
resourceGroupNamestringThe name of the resource group. The name is case insensitive.
subscriptionIdstring (uuid)The ID of the target subscription. The value must be an UUID.
virtualMachineNamestringThe name of the virtual machine.

SELECT examples

Get properties of the provided virtual machine.

SELECT
extendedLocation,
location,
properties,
tags
FROM azure.nexus.virtual_machines
WHERE subscriptionId = '{{ subscriptionId }}' -- required
AND resourceGroupName = '{{ resourceGroupName }}' -- required
AND virtualMachineName = '{{ virtualMachineName }}' -- required
;

INSERT examples

Create a new virtual machine or update the properties of the existing virtual machine.

INSERT INTO azure.nexus.virtual_machines (
data__extendedLocation,
data__properties,
data__tags,
data__location,
subscriptionId,
resourceGroupName,
virtualMachineName
)
SELECT
'{{ extendedLocation }}' /* required */,
'{{ properties }}' /* required */,
'{{ tags }}',
'{{ location }}',
'{{ subscriptionId }}',
'{{ resourceGroupName }}',
'{{ virtualMachineName }}'
RETURNING
extendedLocation,
location,
properties,
tags
;

UPDATE examples

Patch the properties of the provided virtual machine, or update the tags associated with the virtual machine. Properties and tag updates can be done independently.

UPDATE azure.nexus.virtual_machines
SET
data__properties = '{{ properties }}',
data__tags = '{{ tags }}'
WHERE
subscriptionId = '{{ subscriptionId }}' --required
AND resourceGroupName = '{{ resourceGroupName }}' --required
AND virtualMachineName = '{{ virtualMachineName }}' --required
RETURNING
extendedLocation,
location,
properties,
tags;

DELETE examples

Delete the provided virtual machine.

DELETE FROM azure.nexus.virtual_machines
WHERE subscriptionId = '{{ subscriptionId }}' --required
AND resourceGroupName = '{{ resourceGroupName }}' --required
AND virtualMachineName = '{{ virtualMachineName }}' --required
;

Lifecycle Methods

Power off the provided virtual machine.

EXEC azure.nexus.virtual_machines.power_off 
@subscriptionId='{{ subscriptionId }}' --required,
@resourceGroupName='{{ resourceGroupName }}' --required,
@virtualMachineName='{{ virtualMachineName }}' --required
@@json=
'{
"skipShutdown": "{{ skipShutdown }}"
}'
;