VirtualMachinesOperations Class

VirtualMachinesOperations 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)

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.

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, vm_name, parameters, **kwargs)

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 PollingMethod

By default, your polling method will be ARMPolling. 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 LROPoller 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.

begin_convert_to_managed_disks(resource_group_name, vm_name, **kwargs)

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 PollingMethod

By default, your polling method will be ARMPolling. 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 LROPoller 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.

begin_create_or_update(resource_group_name, vm_name, parameters, **kwargs)

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 PollingMethod

By default, your polling method will be ARMPolling. 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 LROPoller 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, vm_name, **kwargs)

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 PollingMethod

By default, your polling method will be ARMPolling. 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 LROPoller 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, vm_name, **kwargs)

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 PollingMethod

By default, your polling method will be ARMPolling. 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 LROPoller that returns either None or the result of cls(response)

Return type

Exceptions

~azure.core.exceptions.HttpResponseError

begin_perform_maintenance

The operation to perform maintenance on a virtual machine.

begin_perform_maintenance(resource_group_name, vm_name, **kwargs)

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 PollingMethod

By default, your polling method will be ARMPolling. 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 LROPoller 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, vm_name, **kwargs)

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 PollingMethod

By default, your polling method will be ARMPolling. 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 LROPoller 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, vm_name, **kwargs)

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 PollingMethod

By default, your polling method will be ARMPolling. 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 LROPoller 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, vm_name, parameters=None, **kwargs)

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 PollingMethod

By default, your polling method will be ARMPolling. 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 LROPoller 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, vm_name, **kwargs)

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 PollingMethod

By default, your polling method will be ARMPolling. 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 LROPoller 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, vm_name, parameters, **kwargs)

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 PollingMethod

By default, your polling method will be ARMPolling. 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 LROPoller 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, vm_name, **kwargs)

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 PollingMethod

By default, your polling method will be ARMPolling. 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 LROPoller 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, vm_name, parameters, **kwargs)

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 PollingMethod

By default, your polling method will be ARMPolling. 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 LROPoller that returns either VirtualMachine or the result of cls(response)

Return type

Exceptions

~azure.core.exceptions.HttpResponseError

generalize

Sets the state of the virtual machine to generalized.

generalize(resource_group_name, vm_name, **kwargs)

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, vm_name, expand='instanceView', **kwargs)

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, vm_name, **kwargs)

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, **kwargs)

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(**kwargs)

Parameters

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, vm_name, **kwargs)

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, **kwargs)

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

Attributes

models

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