VirtualMachinesOperations Class

VirtualMachinesOperations async operations.

You should not instantiate this class directly. Instead, you should create a Client instance that instantiates it for you and attaches it as an attribute.

Inheritance
builtins.object
VirtualMachinesOperations

Constructor

VirtualMachinesOperations(client, config, serializer, deserializer) -> None

Parameters

client
Required

Client for service requests.

config
Required

Configuration of service client.

serializer
Required

An object model serializer.

deserializer
Required

An object model deserializer.

Variables

models

Alias to model classes used in this operation group.

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. >>:code:<br>For Windows, please refer to Convert a virtual machine from unmanaged disks to managed disks. <https://docs.microsoft.com/en-us/azure/virtual-machines/windows/convert-unmanaged-to-managed-disks>_<<.:code:
For Linux, please refer to Convert a virtual machine from unmanaged disks to managed disks.
.

begin_create_or_update

The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation.

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

Shuts down the virtual machine, moves it to an already updated node, and powers it back on during the self-service phase of planned maintenance.

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_reapply

The operation to reapply a virtual machine's state.

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 OS state of the virtual machine to generalized. It is recommended to sysprep the virtual machine before performing this operation. >>:code:<br>For Windows, please refer to Create a managed image of a generalized VM in Azure <https://docs.microsoft.com/en-us/azure/virtual-machines/windows/capture-image-resource>_<<.:code:
For Linux, please refer to How to create an image of a virtual machine or VHD
.

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.

simulate_eviction

The operation to simulate the eviction of spot virtual machine. The eviction will occur within 30 minutes of calling the API.

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: azure.mgmt.compute.v2019_12_01.models._models_py3.VirtualMachineCaptureParameters, **kwargs: typing.Any) -> azure.core.polling._async_poller.AsyncLROPoller[_ForwardRef('_models.VirtualMachineCaptureResult')]

Parameters

resource_group_name
str
Required

The name of the resource group.

vm_name
str
Required

The name of the virtual machine.

parameters
VirtualMachineCaptureParameters
Required

Parameters supplied to the Capture Virtual Machine operation.

cls
callable

A custom type or function that will be passed the direct response

continuation_token
str

A continuation token to restart a poller from a saved state.

polling
bool or AsyncPollingMethod

By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.

polling_interval
int

Default waiting time between two polls for LRO operations if no Retry-After header is present.

Returns

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

Return type

Exceptions

~azure.core.exceptions.HttpResponseError

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. >>:code:<br>For Windows, please refer to Convert a virtual machine from unmanaged disks to managed disks. <https://docs.microsoft.com/en-us/azure/virtual-machines/windows/convert-unmanaged-to-managed-disks>_<<.:code:
For Linux, please refer to Convert a virtual machine from unmanaged disks to managed disks.
.

begin_convert_to_managed_disks(resource_group_name: str, vm_name: str, **kwargs: typing.Any) -> azure.core.polling._async_poller.AsyncLROPoller[NoneType]

Parameters

resource_group_name
str
Required

The name of the resource group.

vm_name
str
Required

The name of the virtual machine.

cls
callable

A custom type or function that will be passed the direct response

continuation_token
str

A continuation token to restart a poller from a saved state.

polling
bool or AsyncPollingMethod

By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.

polling_interval
int

Default waiting time between two polls for LRO operations if no Retry-After header is present.

Returns

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

Return type

Exceptions

~azure.core.exceptions.HttpResponseError

begin_create_or_update

The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation.

begin_create_or_update(resource_group_name: str, vm_name: str, parameters: azure.mgmt.compute.v2019_12_01.models._models_py3.VirtualMachine, **kwargs: typing.Any) -> azure.core.polling._async_poller.AsyncLROPoller[_ForwardRef('_models.VirtualMachine')]

Parameters

resource_group_name
str
Required

The name of the resource group.

vm_name
str
Required

The name of the virtual machine.

parameters
VirtualMachine
Required

Parameters supplied to the Create Virtual Machine operation.

cls
callable

A custom type or function that will be passed the direct response

continuation_token
str

A continuation token to restart a poller from a saved state.

polling
bool or AsyncPollingMethod

By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.

polling_interval
int

Default waiting time between two polls for LRO operations if no Retry-After header is present.

Returns

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

Return type

Exceptions

~azure.core.exceptions.HttpResponseError

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: typing.Any) -> azure.core.polling._async_poller.AsyncLROPoller[NoneType]

Parameters

resource_group_name
str
Required

The name of the resource group.

vm_name
str
Required

The name of the virtual machine.

cls
callable

A custom type or function that will be passed the direct response

continuation_token
str

A continuation token to restart a poller from a saved state.

polling
bool or AsyncPollingMethod

By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.

polling_interval
int

Default waiting time between two polls for LRO operations if no Retry-After header is present.

Returns

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

Return type

Exceptions

~azure.core.exceptions.HttpResponseError

begin_delete

The operation to delete a virtual machine.

begin_delete(resource_group_name: str, vm_name: str, **kwargs: typing.Any) -> azure.core.polling._async_poller.AsyncLROPoller[NoneType]

Parameters

resource_group_name
str
Required

The name of the resource group.

vm_name
str
Required

The name of the virtual machine.

cls
callable

A custom type or function that will be passed the direct response

continuation_token
str

A continuation token to restart a poller from a saved state.

polling
bool or AsyncPollingMethod

By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.

polling_interval
int

Default waiting time between two polls for LRO operations if no Retry-After header is present.

Returns

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

Return type

Exceptions

~azure.core.exceptions.HttpResponseError

begin_perform_maintenance

Shuts down the virtual machine, moves it to an already updated node, and powers it back on during the self-service phase of planned maintenance.

begin_perform_maintenance(resource_group_name: str, vm_name: str, **kwargs: typing.Any) -> azure.core.polling._async_poller.AsyncLROPoller[NoneType]

Parameters

resource_group_name
str
Required

The name of the resource group.

vm_name
str
Required

The name of the virtual machine.

cls
callable

A custom type or function that will be passed the direct response

continuation_token
str

A continuation token to restart a poller from a saved state.

polling
bool or AsyncPollingMethod

By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.

polling_interval
int

Default waiting time between two polls for LRO operations if no Retry-After header is present.

Returns

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

Return type

Exceptions

~azure.core.exceptions.HttpResponseError

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, skip_shutdown: typing.Union[bool, NoneType] = False, **kwargs: typing.Any) -> azure.core.polling._async_poller.AsyncLROPoller[NoneType]

Parameters

resource_group_name
str
Required

The name of the resource group.

vm_name
str
Required

The name of the virtual machine.

skip_shutdown
bool
default value: False

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.

cls
callable

A custom type or function that will be passed the direct response

continuation_token
str

A continuation token to restart a poller from a saved state.

polling
bool or AsyncPollingMethod

By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.

polling_interval
int

Default waiting time between two polls for LRO operations if no Retry-After header is present.

Returns

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

Return type

Exceptions

~azure.core.exceptions.HttpResponseError

begin_reapply

The operation to reapply a virtual machine's state.

begin_reapply(resource_group_name: str, vm_name: str, **kwargs: typing.Any) -> azure.core.polling._async_poller.AsyncLROPoller[NoneType]

Parameters

resource_group_name
str
Required

The name of the resource group.

vm_name
str
Required

The name of the virtual machine.

cls
callable

A custom type or function that will be passed the direct response

continuation_token
str

A continuation token to restart a poller from a saved state.

polling
bool or AsyncPollingMethod

By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.

polling_interval
int

Default waiting time between two polls for LRO operations if no Retry-After header is present.

Returns

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

Return type

Exceptions

~azure.core.exceptions.HttpResponseError

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: typing.Any) -> azure.core.polling._async_poller.AsyncLROPoller[NoneType]

Parameters

resource_group_name
str
Required

The name of the resource group.

vm_name
str
Required

The name of the virtual machine.

cls
callable

A custom type or function that will be passed the direct response

continuation_token
str

A continuation token to restart a poller from a saved state.

polling
bool or AsyncPollingMethod

By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.

polling_interval
int

Default waiting time between two polls for LRO operations if no Retry-After header is present.

Returns

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

Return type

Exceptions

~azure.core.exceptions.HttpResponseError

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: typing.Union[_ForwardRef('_models.VirtualMachineReimageParameters'), NoneType] = None, **kwargs: typing.Any) -> azure.core.polling._async_poller.AsyncLROPoller[NoneType]

Parameters

resource_group_name
str
Required

The name of the resource group.

vm_name
str
Required

The name of the virtual machine.

parameters
VirtualMachineReimageParameters
default value: None

Parameters supplied to the Reimage Virtual Machine operation.

cls
callable

A custom type or function that will be passed the direct response

continuation_token
str

A continuation token to restart a poller from a saved state.

polling
bool or AsyncPollingMethod

By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.

polling_interval
int

Default waiting time between two polls for LRO operations if no Retry-After header is present.

Returns

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

Return type

Exceptions

~azure.core.exceptions.HttpResponseError

begin_restart

The operation to restart a virtual machine.

begin_restart(resource_group_name: str, vm_name: str, **kwargs: typing.Any) -> azure.core.polling._async_poller.AsyncLROPoller[NoneType]

Parameters

resource_group_name
str
Required

The name of the resource group.

vm_name
str
Required

The name of the virtual machine.

cls
callable

A custom type or function that will be passed the direct response

continuation_token
str

A continuation token to restart a poller from a saved state.

polling
bool or AsyncPollingMethod

By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.

polling_interval
int

Default waiting time between two polls for LRO operations if no Retry-After header is present.

Returns

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

Return type

Exceptions

~azure.core.exceptions.HttpResponseError

begin_run_command

Run command on the VM.

begin_run_command(resource_group_name: str, vm_name: str, parameters: azure.mgmt.compute.v2019_12_01.models._models_py3.RunCommandInput, **kwargs: typing.Any) -> azure.core.polling._async_poller.AsyncLROPoller[_ForwardRef('_models.RunCommandResult')]

Parameters

resource_group_name
str
Required

The name of the resource group.

vm_name
str
Required

The name of the virtual machine.

parameters
RunCommandInput
Required

Parameters supplied to the Run command operation.

cls
callable

A custom type or function that will be passed the direct response

continuation_token
str

A continuation token to restart a poller from a saved state.

polling
bool or AsyncPollingMethod

By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.

polling_interval
int

Default waiting time between two polls for LRO operations if no Retry-After header is present.

Returns

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

Return type

Exceptions

~azure.core.exceptions.HttpResponseError

begin_start

The operation to start a virtual machine.

begin_start(resource_group_name: str, vm_name: str, **kwargs: typing.Any) -> azure.core.polling._async_poller.AsyncLROPoller[NoneType]

Parameters

resource_group_name
str
Required

The name of the resource group.

vm_name
str
Required

The name of the virtual machine.

cls
callable

A custom type or function that will be passed the direct response

continuation_token
str

A continuation token to restart a poller from a saved state.

polling
bool or AsyncPollingMethod

By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.

polling_interval
int

Default waiting time between two polls for LRO operations if no Retry-After header is present.

Returns

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

Return type

Exceptions

~azure.core.exceptions.HttpResponseError

begin_update

The operation to update a virtual machine.

begin_update(resource_group_name: str, vm_name: str, parameters: azure.mgmt.compute.v2019_12_01.models._models_py3.VirtualMachineUpdate, **kwargs: typing.Any) -> azure.core.polling._async_poller.AsyncLROPoller[_ForwardRef('_models.VirtualMachine')]

Parameters

resource_group_name
str
Required

The name of the resource group.

vm_name
str
Required

The name of the virtual machine.

parameters
VirtualMachineUpdate
Required

Parameters supplied to the Update Virtual Machine operation.

cls
callable

A custom type or function that will be passed the direct response

continuation_token
str

A continuation token to restart a poller from a saved state.

polling
bool or AsyncPollingMethod

By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.

polling_interval
int

Default waiting time between two polls for LRO operations if no Retry-After header is present.

Returns

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

Return type

Exceptions

~azure.core.exceptions.HttpResponseError

generalize

Sets the OS state of the virtual machine to generalized. It is recommended to sysprep the virtual machine before performing this operation. >>:code:<br>For Windows, please refer to Create a managed image of a generalized VM in Azure <https://docs.microsoft.com/en-us/azure/virtual-machines/windows/capture-image-resource>_<<.:code:
For Linux, please refer to How to create an image of a virtual machine or VHD
.

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

Parameters

resource_group_name
str
Required

The name of the resource group.

vm_name
str
Required

The name of the virtual machine.

cls
callable

A custom type or function that will be passed the direct response

Returns

None, or the result of cls(response)

Return type

Exceptions

~azure.core.exceptions.HttpResponseError

get

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

get(resource_group_name: str, vm_name: str, expand: typing.Union[str, NoneType] = 'instanceView', **kwargs: typing.Any) -> azure.mgmt.compute.v2019_12_01.models._models_py3.VirtualMachine

Parameters

resource_group_name
str
Required

The name of the resource group.

vm_name
str
Required

The name of the virtual machine.

expand
str
default value: instanceView

The expand expression to apply on the operation.

cls
callable

A custom type or function that will be passed the direct response

Returns

VirtualMachine, or the result of cls(response)

Return type

Exceptions

~azure.core.exceptions.HttpResponseError

instance_view

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

instance_view(resource_group_name: str, vm_name: str, **kwargs: typing.Any) -> azure.mgmt.compute.v2019_12_01.models._models_py3.VirtualMachineInstanceView

Parameters

resource_group_name
str
Required

The name of the resource group.

vm_name
str
Required

The name of the virtual machine.

cls
callable

A custom type or function that will be passed the direct response

Returns

VirtualMachineInstanceView, or the result of cls(response)

Return type

Exceptions

~azure.core.exceptions.HttpResponseError

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: typing.Any) -> typing.AsyncIterable[_ForwardRef('_models.VirtualMachineListResult')]

Parameters

resource_group_name
str
Required

The name of the resource group.

cls
callable

A custom type or function that will be passed the direct response

Returns

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

Return type

Exceptions

~azure.core.exceptions.HttpResponseError

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(status_only: typing.Union[str, NoneType] = None, **kwargs: typing.Any) -> typing.AsyncIterable[_ForwardRef('_models.VirtualMachineListResult')]

Parameters

status_only
str
default value: None

statusOnly=true enables fetching run time status of all Virtual Machines in the subscription.

cls
callable

A custom type or function that will be passed the direct response

Returns

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

Return type

Exceptions

~azure.core.exceptions.HttpResponseError

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: typing.Any) -> typing.AsyncIterable[_ForwardRef('_models.VirtualMachineSizeListResult')]

Parameters

resource_group_name
str
Required

The name of the resource group.

vm_name
str
Required

The name of the virtual machine.

cls
callable

A custom type or function that will be passed the direct response

Returns

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

Return type

Exceptions

~azure.core.exceptions.HttpResponseError

list_by_location

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

list_by_location(location: str, **kwargs: typing.Any) -> typing.AsyncIterable[_ForwardRef('_models.VirtualMachineListResult')]

Parameters

location
str
Required

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

cls
callable

A custom type or function that will be passed the direct response

Returns

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

Return type

Exceptions

~azure.core.exceptions.HttpResponseError

simulate_eviction

The operation to simulate the eviction of spot virtual machine. The eviction will occur within 30 minutes of calling the API.

simulate_eviction(resource_group_name: str, vm_name: str, **kwargs: typing.Any) -> None

Parameters

resource_group_name
str
Required

The name of the resource group.

vm_name
str
Required

The name of the virtual machine.

cls
callable

A custom type or function that will be passed the direct response

Returns

None, or the result of cls(response)

Return type

Exceptions

~azure.core.exceptions.HttpResponseError

Attributes

models

models = <module 'azure.mgmt.compute.v2019_12_01.models' from 'C:\\hostedtoolcache\\windows\\Python\\3.6.8\\x64\\lib\\site-packages\\azure\\mgmt\\compute\\v2019_12_01\\models\\__init__.py'>