VirtualMachinesOperations Class

Warning

DO NOT instantiate this class directly.

Instead, you should access the following operations through

ComputeManagementClient's

<xref:virtual_machines> attribute.

Inheritance
builtins.object
VirtualMachinesOperations

Constructor

VirtualMachinesOperations(*args, **kwargs)

Methods

begin_capture

Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar VMs.

begin_convert_to_managed_disks

Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before invoking this operation.

begin_create_or_update

The operation to create or update a virtual machine.

begin_deallocate

Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources that this virtual machine uses.

begin_delete

The operation to delete a virtual machine.

begin_perform_maintenance

The operation to perform maintenance on a virtual machine.

begin_power_off

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.

begin_redeploy

Shuts down the virtual machine, moves it to a new node, and powers it back on.

begin_reimage

Reimages the virtual machine which has an ephemeral OS disk back to its initial state.

begin_restart

The operation to restart a virtual machine.

begin_run_command

Run command on the VM.

begin_start

The operation to start a virtual machine.

begin_update

The operation to update a virtual machine.

generalize

Sets the state of the virtual machine to generalized.

get

Retrieves information about the model view or the instance view of a virtual machine.

instance_view

Retrieves information about the run-time state of a virtual machine.

list

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_all

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.

list_available_sizes

Lists all available virtual machine sizes to which the specified virtual machine can be resized.

list_by_location

Gets all the virtual machines under the specified subscription for the specified location.

begin_capture

Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar VMs.

begin_capture(resource_group_name: str, vm_name: str, parameters: _models.VirtualMachineCaptureParameters, *, content_type: str = 'application/json', **kwargs: Any) -> LROPoller[_models.VirtualMachineCaptureResult]

Parameters

resource_group_name
str
Required

The name of the resource group. Required.

vm_name
str
Required

The name of the virtual machine. Required.

parameters
VirtualMachineCaptureParameters or IO[bytes]
Required

Parameters supplied to the Capture Virtual Machine operation. Is either a VirtualMachineCaptureParameters type or a IO[bytes] type. Required.

Returns

An instance of LROPoller that returns either VirtualMachineCaptureResult or the result of cls(response)

Return type

Exceptions

begin_convert_to_managed_disks

Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before invoking this operation.

begin_convert_to_managed_disks(resource_group_name: str, vm_name: str, **kwargs: Any) -> LROPoller[None]

Parameters

resource_group_name
str
Required

The name of the resource group. Required.

vm_name
str
Required

The name of the virtual machine. Required.

Returns

An instance of LROPoller that returns either None or the result of cls(response)

Return type

Exceptions

begin_create_or_update

The operation to create or update a virtual machine.

begin_create_or_update(resource_group_name: str, vm_name: str, parameters: _models.VirtualMachine, *, content_type: str = 'application/json', **kwargs: Any) -> LROPoller[_models.VirtualMachine]

Parameters

resource_group_name
str
Required

The name of the resource group. Required.

vm_name
str
Required

The name of the virtual machine. Required.

parameters
VirtualMachine or IO[bytes]
Required

Parameters supplied to the Create Virtual Machine operation. Is either a VirtualMachine type or a IO[bytes] type. Required.

Returns

An instance of LROPoller that returns either VirtualMachine or the result of cls(response)

Return type

Exceptions

begin_deallocate

Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources that this virtual machine uses.

begin_deallocate(resource_group_name: str, vm_name: str, **kwargs: Any) -> LROPoller[None]

Parameters

resource_group_name
str
Required

The name of the resource group. Required.

vm_name
str
Required

The name of the virtual machine. Required.

Returns

An instance of LROPoller that returns either None or the result of cls(response)

Return type

Exceptions

begin_delete

The operation to delete a virtual machine.

begin_delete(resource_group_name: str, vm_name: str, **kwargs: Any) -> LROPoller[None]

Parameters

resource_group_name
str
Required

The name of the resource group. Required.

vm_name
str
Required

The name of the virtual machine. Required.

Returns

An instance of LROPoller that returns either None or the result of cls(response)

Return type

Exceptions

begin_perform_maintenance

The operation to perform maintenance on a virtual machine.

begin_perform_maintenance(resource_group_name: str, vm_name: str, **kwargs: Any) -> LROPoller[None]

Parameters

resource_group_name
str
Required

The name of the resource group. Required.

vm_name
str
Required

The name of the virtual machine. Required.

Returns

An instance of LROPoller that returns either None or the result of cls(response)

Return type

Exceptions

begin_power_off

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.

begin_power_off(resource_group_name: str, vm_name: str, **kwargs: Any) -> LROPoller[None]

Parameters

resource_group_name
str
Required

The name of the resource group. Required.

vm_name
str
Required

The name of the virtual machine. Required.

Returns

An instance of LROPoller that returns either None or the result of cls(response)

Return type

Exceptions

begin_redeploy

Shuts down the virtual machine, moves it to a new node, and powers it back on.

begin_redeploy(resource_group_name: str, vm_name: str, **kwargs: Any) -> LROPoller[None]

Parameters

resource_group_name
str
Required

The name of the resource group. Required.

vm_name
str
Required

The name of the virtual machine. Required.

Returns

An instance of LROPoller that returns either None or the result of cls(response)

Return type

Exceptions

begin_reimage

Reimages the virtual machine which has an ephemeral OS disk back to its initial state.

begin_reimage(resource_group_name: str, vm_name: str, parameters: _models.VirtualMachineReimageParameters | None = None, *, content_type: str = 'application/json', **kwargs: Any) -> LROPoller[None]

Parameters

resource_group_name
str
Required

The name of the resource group. Required.

vm_name
str
Required

The name of the virtual machine. Required.

parameters
VirtualMachineReimageParameters or IO[bytes]
Required

Parameters supplied to the Reimage Virtual Machine operation. Is either a VirtualMachineReimageParameters type or a IO[bytes] type. Default value is None.

Returns

An instance of LROPoller that returns either None or the result of cls(response)

Return type

Exceptions

begin_restart

The operation to restart a virtual machine.

begin_restart(resource_group_name: str, vm_name: str, **kwargs: Any) -> LROPoller[None]

Parameters

resource_group_name
str
Required

The name of the resource group. Required.

vm_name
str
Required

The name of the virtual machine. Required.

Returns

An instance of LROPoller that returns either None or the result of cls(response)

Return type

Exceptions

begin_run_command

Run command on the VM.

begin_run_command(resource_group_name: str, vm_name: str, parameters: _models.RunCommandInput, *, content_type: str = 'application/json', **kwargs: Any) -> LROPoller[_models.RunCommandResult]

Parameters

resource_group_name
str
Required

The name of the resource group. Required.

vm_name
str
Required

The name of the virtual machine. Required.

parameters
RunCommandInput or IO[bytes]
Required

Parameters supplied to the Run command operation. Is either a RunCommandInput type or a IO[bytes] type. Required.

Returns

An instance of LROPoller that returns either RunCommandResult or the result of cls(response)

Return type

Exceptions

begin_start

The operation to start a virtual machine.

begin_start(resource_group_name: str, vm_name: str, **kwargs: Any) -> LROPoller[None]

Parameters

resource_group_name
str
Required

The name of the resource group. Required.

vm_name
str
Required

The name of the virtual machine. Required.

Returns

An instance of LROPoller that returns either None or the result of cls(response)

Return type

Exceptions

begin_update

The operation to update a virtual machine.

begin_update(resource_group_name: str, vm_name: str, parameters: _models.VirtualMachineUpdate, *, content_type: str = 'application/json', **kwargs: Any) -> LROPoller[_models.VirtualMachine]

Parameters

resource_group_name
str
Required

The name of the resource group. Required.

vm_name
str
Required

The name of the virtual machine. Required.

parameters
VirtualMachineUpdate or IO[bytes]
Required

Parameters supplied to the Update Virtual Machine operation. Is either a VirtualMachineUpdate type or a IO[bytes] type. Required.

Returns

An instance of LROPoller that returns either VirtualMachine or the result of cls(response)

Return type

Exceptions

generalize

Sets the state of the virtual machine to generalized.

generalize(resource_group_name: str, vm_name: str, **kwargs: Any) -> None

Parameters

resource_group_name
str
Required

The name of the resource group. Required.

vm_name
str
Required

The name of the virtual machine. Required.

Returns

None or the result of cls(response)

Return type

Exceptions

get

Retrieves information about the model view or the instance view of a virtual machine.

get(resource_group_name: str, vm_name: str, *, expand: Literal['instanceView'] = 'instanceView', **kwargs: Any) -> VirtualMachine

Parameters

resource_group_name
str
Required

The name of the resource group. Required.

vm_name
str
Required

The name of the virtual machine. Required.

Keyword-Only Parameters

expand
str

The expand expression to apply on the operation. Known values are "instanceView" and None. Default value is "instanceView".

Returns

VirtualMachine or the result of cls(response)

Return type

Exceptions

instance_view

Retrieves information about the run-time state of a virtual machine.

instance_view(resource_group_name: str, vm_name: str, **kwargs: Any) -> VirtualMachineInstanceView

Parameters

resource_group_name
str
Required

The name of the resource group. Required.

vm_name
str
Required

The name of the virtual machine. Required.

Returns

VirtualMachineInstanceView or the result of cls(response)

Return type

Exceptions

list

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(resource_group_name: str, **kwargs: Any) -> Iterable[VirtualMachine]

Parameters

resource_group_name
str
Required

The name of the resource group. Required.

Returns

An iterator like instance of either VirtualMachine or the result of cls(response)

Return type

Exceptions

list_all

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.

list_all(**kwargs: Any) -> Iterable[VirtualMachine]

Returns

An iterator like instance of either VirtualMachine or the result of cls(response)

Return type

Exceptions

list_available_sizes

Lists all available virtual machine sizes to which the specified virtual machine can be resized.

list_available_sizes(resource_group_name: str, vm_name: str, **kwargs: Any) -> Iterable[VirtualMachineSize]

Parameters

resource_group_name
str
Required

The name of the resource group. Required.

vm_name
str
Required

The name of the virtual machine. Required.

Returns

An iterator like instance of either VirtualMachineSize or the result of cls(response)

Return type

Exceptions

list_by_location

Gets all the virtual machines under the specified subscription for the specified location.

list_by_location(location: str, **kwargs: Any) -> Iterable[VirtualMachine]

Parameters

location
str
Required

The location for which virtual machines under the subscription are queried. Required.

Returns

An iterator like instance of either VirtualMachine or the result of cls(response)

Return type

Exceptions

Attributes

models

models = <module 'azure.mgmt.compute.v2018_06_01.models' from 'C:\\hostedtoolcache\\windows\\Python\\3.11.7\\x64\\Lib\\site-packages\\azure\\mgmt\\compute\\v2018_06_01\\models\\__init__.py'>