VirtualMachinesOperations class

Definition

VirtualMachinesOperations operations.

You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute.

VirtualMachinesOperations(client, config, serializer, deserializer)
Inheritance
builtins.object
VirtualMachinesOperations

Parameters

client

Client for service requests.

config

Configuration of service client.

serializer

An object model serializer.

deserializer

An object model deserializer.

Variables

api_version
class
Client Api Version. Constant value: "2018-10-01".

Methods

capture(resource_group_name, vm_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config)

Captures 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_disks(resource_group_name, vm_name, custom_headers=None, raw=False, polling=True, **operation_config)

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

create_or_update(resource_group_name, vm_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config)

The operation to create or update a virtual machine.

deallocate(resource_group_name, vm_name, custom_headers=None, raw=False, polling=True, **operation_config)

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

delete(resource_group_name, vm_name, custom_headers=None, raw=False, polling=True, **operation_config)

The operation to delete a virtual machine.

generalize(resource_group_name, vm_name, custom_headers=None, raw=False, **operation_config)

Sets the state of the virtual machine to generalized.

get(resource_group_name, vm_name, expand=None, custom_headers=None, raw=False, **operation_config)

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

instance_view(resource_group_name, vm_name, custom_headers=None, raw=False, **operation_config)

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

list(resource_group_name, custom_headers=None, raw=False, **operation_config)

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(custom_headers=None, raw=False, **operation_config)

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(resource_group_name, vm_name, custom_headers=None, raw=False, **operation_config)

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

list_by_location(location, custom_headers=None, raw=False, **operation_config)

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

perform_maintenance(resource_group_name, vm_name, custom_headers=None, raw=False, polling=True, **operation_config)

The operation to perform maintenance on a virtual machine.

power_off(resource_group_name, vm_name, custom_headers=None, raw=False, polling=True, **operation_config)

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.

redeploy(resource_group_name, vm_name, custom_headers=None, raw=False, polling=True, **operation_config)

The operation to redeploy a virtual machine.

reimage(resource_group_name, vm_name, temp_disk=None, custom_headers=None, raw=False, polling=True, **operation_config)

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

restart(resource_group_name, vm_name, custom_headers=None, raw=False, polling=True, **operation_config)

The operation to restart a virtual machine.

run_command(resource_group_name, vm_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config)

Run command on the VM.

start(resource_group_name, vm_name, custom_headers=None, raw=False, polling=True, **operation_config)

The operation to start a virtual machine.

update(resource_group_name, vm_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config)

The operation to update a virtual machine.

capture(resource_group_name, vm_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config)

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

capture(resource_group_name, vm_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config)

Parameters

resource_group_name
str

The name of the resource group.

vm_name
str

The name of the virtual machine.

parameters
VirtualMachineCaptureParameters

Parameters supplied to the Capture Virtual Machine operation.

custom_headers
dict

headers that will be added to the request

default value: None
raw
bool

The poller return type is ClientRawResponse, the direct response alongside the deserialized response

default value: False
polling

True for ARMPolling, False for no polling, or a polling object for personal polling strategy

default value: True

Returns

An instance of LROPoller that returns VirtualMachineCaptureResult or ClientRawResponse if raw==True

Return type

Exceptions

convert_to_managed_disks(resource_group_name, vm_name, custom_headers=None, raw=False, polling=True, **operation_config)

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

convert_to_managed_disks(resource_group_name, vm_name, custom_headers=None, raw=False, polling=True, **operation_config)

Parameters

resource_group_name
str

The name of the resource group.

vm_name
str

The name of the virtual machine.

custom_headers
dict

headers that will be added to the request

default value: None
raw
bool

The poller return type is ClientRawResponse, the direct response alongside the deserialized response

default value: False
polling

True for ARMPolling, False for no polling, or a polling object for personal polling strategy

default value: True

Returns

An instance of LROPoller that returns None or ClientRawResponse if raw==True

Return type

Exceptions

create_or_update(resource_group_name, vm_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config)

The operation to create or update a virtual machine.

create_or_update(resource_group_name, vm_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config)

Parameters

resource_group_name
str

The name of the resource group.

vm_name
str

The name of the virtual machine.

parameters
VirtualMachine

Parameters supplied to the Create Virtual Machine operation.

custom_headers
dict

headers that will be added to the request

default value: None
raw
bool

The poller return type is ClientRawResponse, the direct response alongside the deserialized response

default value: False
polling

True for ARMPolling, False for no polling, or a polling object for personal polling strategy

default value: True

Returns

An instance of LROPoller that returns VirtualMachine or ClientRawResponse if raw==True

Return type

Exceptions

deallocate(resource_group_name, vm_name, custom_headers=None, raw=False, polling=True, **operation_config)

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

deallocate(resource_group_name, vm_name, custom_headers=None, raw=False, polling=True, **operation_config)

Parameters

resource_group_name
str

The name of the resource group.

vm_name
str

The name of the virtual machine.

custom_headers
dict

headers that will be added to the request

default value: None
raw
bool

The poller return type is ClientRawResponse, the direct response alongside the deserialized response

default value: False
polling

True for ARMPolling, False for no polling, or a polling object for personal polling strategy

default value: True

Returns

An instance of LROPoller that returns None or ClientRawResponse if raw==True

Return type

Exceptions

delete(resource_group_name, vm_name, custom_headers=None, raw=False, polling=True, **operation_config)

The operation to delete a virtual machine.

delete(resource_group_name, vm_name, custom_headers=None, raw=False, polling=True, **operation_config)

Parameters

resource_group_name
str

The name of the resource group.

vm_name
str

The name of the virtual machine.

custom_headers
dict

headers that will be added to the request

default value: None
raw
bool

The poller return type is ClientRawResponse, the direct response alongside the deserialized response

default value: False
polling

True for ARMPolling, False for no polling, or a polling object for personal polling strategy

default value: True

Returns

An instance of LROPoller that returns None or ClientRawResponse if raw==True

Return type

Exceptions

generalize(resource_group_name, vm_name, custom_headers=None, raw=False, **operation_config)

Sets the state of the virtual machine to generalized.

generalize(resource_group_name, vm_name, custom_headers=None, raw=False, **operation_config)

Parameters

resource_group_name
str

The name of the resource group.

vm_name
str

The name of the virtual machine.

custom_headers
dict

headers that will be added to the request

default value: None
raw
bool

returns the direct response alongside the deserialized response

default value: False
operation_config

Operation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

Exceptions

get(resource_group_name, vm_name, expand=None, custom_headers=None, raw=False, **operation_config)

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

get(resource_group_name, vm_name, expand=None, custom_headers=None, raw=False, **operation_config)

Parameters

resource_group_name
str

The name of the resource group.

vm_name
str

The name of the virtual machine.

expand
str or InstanceViewTypes

The expand expression to apply on the operation. Possible values include: 'instanceView'

default value: None
custom_headers
dict

headers that will be added to the request

default value: None
raw
bool

returns the direct response alongside the deserialized response

default value: False
operation_config

Operation configuration overrides.

Returns

VirtualMachine or ClientRawResponse if raw=true

Return type

Exceptions

instance_view(resource_group_name, vm_name, custom_headers=None, raw=False, **operation_config)

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

instance_view(resource_group_name, vm_name, custom_headers=None, raw=False, **operation_config)

Parameters

resource_group_name
str

The name of the resource group.

vm_name
str

The name of the virtual machine.

custom_headers
dict

headers that will be added to the request

default value: None
raw
bool

returns the direct response alongside the deserialized response

default value: False
operation_config

Operation configuration overrides.

Returns

VirtualMachineInstanceView or ClientRawResponse if raw=true

Return type

Exceptions

list(resource_group_name, custom_headers=None, raw=False, **operation_config)

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, custom_headers=None, raw=False, **operation_config)

Parameters

resource_group_name
str

The name of the resource group.

custom_headers
dict

headers that will be added to the request

default value: None
raw
bool

returns the direct response alongside the deserialized response

default value: False
operation_config

Operation configuration overrides.

Returns

An iterator like instance of VirtualMachine

Return type

Exceptions

list_all(custom_headers=None, raw=False, **operation_config)

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(custom_headers=None, raw=False, **operation_config)

Parameters

custom_headers
dict

headers that will be added to the request

default value: None
raw
bool

returns the direct response alongside the deserialized response

default value: False
operation_config

Operation configuration overrides.

Returns

An iterator like instance of VirtualMachine

Return type

Exceptions

list_available_sizes(resource_group_name, vm_name, custom_headers=None, raw=False, **operation_config)

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

list_available_sizes(resource_group_name, vm_name, custom_headers=None, raw=False, **operation_config)

Parameters

resource_group_name
str

The name of the resource group.

vm_name
str

The name of the virtual machine.

custom_headers
dict

headers that will be added to the request

default value: None
raw
bool

returns the direct response alongside the deserialized response

default value: False
operation_config

Operation configuration overrides.

Returns

An iterator like instance of VirtualMachineSize

Return type

Exceptions

list_by_location(location, custom_headers=None, raw=False, **operation_config)

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

list_by_location(location, custom_headers=None, raw=False, **operation_config)

Parameters

location
str

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

custom_headers
dict

headers that will be added to the request

default value: None
raw
bool

returns the direct response alongside the deserialized response

default value: False
operation_config

Operation configuration overrides.

Returns

An iterator like instance of VirtualMachine

Return type

Exceptions

perform_maintenance(resource_group_name, vm_name, custom_headers=None, raw=False, polling=True, **operation_config)

The operation to perform maintenance on a virtual machine.

perform_maintenance(resource_group_name, vm_name, custom_headers=None, raw=False, polling=True, **operation_config)

Parameters

resource_group_name
str

The name of the resource group.

vm_name
str

The name of the virtual machine.

custom_headers
dict

headers that will be added to the request

default value: None
raw
bool

The poller return type is ClientRawResponse, the direct response alongside the deserialized response

default value: False
polling

True for ARMPolling, False for no polling, or a polling object for personal polling strategy

default value: True

Returns

An instance of LROPoller that returns None or ClientRawResponse if raw==True

Return type

Exceptions

power_off(resource_group_name, vm_name, custom_headers=None, raw=False, polling=True, **operation_config)

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.

power_off(resource_group_name, vm_name, custom_headers=None, raw=False, polling=True, **operation_config)

Parameters

resource_group_name
str

The name of the resource group.

vm_name
str

The name of the virtual machine.

custom_headers
dict

headers that will be added to the request

default value: None
raw
bool

The poller return type is ClientRawResponse, the direct response alongside the deserialized response

default value: False
polling

True for ARMPolling, False for no polling, or a polling object for personal polling strategy

default value: True

Returns

An instance of LROPoller that returns None or ClientRawResponse if raw==True

Return type

Exceptions

redeploy(resource_group_name, vm_name, custom_headers=None, raw=False, polling=True, **operation_config)

The operation to redeploy a virtual machine.

redeploy(resource_group_name, vm_name, custom_headers=None, raw=False, polling=True, **operation_config)

Parameters

resource_group_name
str

The name of the resource group.

vm_name
str

The name of the virtual machine.

custom_headers
dict

headers that will be added to the request

default value: None
raw
bool

The poller return type is ClientRawResponse, the direct response alongside the deserialized response

default value: False
polling

True for ARMPolling, False for no polling, or a polling object for personal polling strategy

default value: True

Returns

An instance of LROPoller that returns None or ClientRawResponse if raw==True

Return type

Exceptions

reimage(resource_group_name, vm_name, temp_disk=None, custom_headers=None, raw=False, polling=True, **operation_config)

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

reimage(resource_group_name, vm_name, temp_disk=None, custom_headers=None, raw=False, polling=True, **operation_config)

Parameters

resource_group_name
str

The name of the resource group.

vm_name
str

The name of the virtual machine.

temp_disk
bool

Specifies whether to reimage temp disk. Default value: false. Note: This temp disk reimage parameter is only supported for VM/VMSS with Ephemeral OS disk.

default value: None
custom_headers
dict

headers that will be added to the request

default value: None
raw
bool

The poller return type is ClientRawResponse, the direct response alongside the deserialized response

default value: False
polling

True for ARMPolling, False for no polling, or a polling object for personal polling strategy

default value: True

Returns

An instance of LROPoller that returns None or ClientRawResponse if raw==True

Return type

Exceptions

restart(resource_group_name, vm_name, custom_headers=None, raw=False, polling=True, **operation_config)

The operation to restart a virtual machine.

restart(resource_group_name, vm_name, custom_headers=None, raw=False, polling=True, **operation_config)

Parameters

resource_group_name
str

The name of the resource group.

vm_name
str

The name of the virtual machine.

custom_headers
dict

headers that will be added to the request

default value: None
raw
bool

The poller return type is ClientRawResponse, the direct response alongside the deserialized response

default value: False
polling

True for ARMPolling, False for no polling, or a polling object for personal polling strategy

default value: True

Returns

An instance of LROPoller that returns None or ClientRawResponse if raw==True

Return type

Exceptions

run_command(resource_group_name, vm_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config)

Run command on the VM.

run_command(resource_group_name, vm_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config)

Parameters

resource_group_name
str

The name of the resource group.

vm_name
str

The name of the virtual machine.

parameters
RunCommandInput

Parameters supplied to the Run command operation.

custom_headers
dict

headers that will be added to the request

default value: None
raw
bool

The poller return type is ClientRawResponse, the direct response alongside the deserialized response

default value: False
polling

True for ARMPolling, False for no polling, or a polling object for personal polling strategy

default value: True

Returns

An instance of LROPoller that returns RunCommandResult or ClientRawResponse if raw==True

Return type

Exceptions

start(resource_group_name, vm_name, custom_headers=None, raw=False, polling=True, **operation_config)

The operation to start a virtual machine.

start(resource_group_name, vm_name, custom_headers=None, raw=False, polling=True, **operation_config)

Parameters

resource_group_name
str

The name of the resource group.

vm_name
str

The name of the virtual machine.

custom_headers
dict

headers that will be added to the request

default value: None
raw
bool

The poller return type is ClientRawResponse, the direct response alongside the deserialized response

default value: False
polling

True for ARMPolling, False for no polling, or a polling object for personal polling strategy

default value: True

Returns

An instance of LROPoller that returns None or ClientRawResponse if raw==True

Return type

Exceptions

update(resource_group_name, vm_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config)

The operation to update a virtual machine.

update(resource_group_name, vm_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config)

Parameters

resource_group_name
str

The name of the resource group.

vm_name
str

The name of the virtual machine.

parameters
VirtualMachineUpdate

Parameters supplied to the Update Virtual Machine operation.

custom_headers
dict

headers that will be added to the request

default value: None
raw
bool

The poller return type is ClientRawResponse, the direct response alongside the deserialized response

default value: False
polling

True for ARMPolling, False for no polling, or a polling object for personal polling strategy

default value: True

Returns

An instance of LROPoller that returns VirtualMachine or ClientRawResponse if raw==True

Return type

Exceptions

Attributes

models

models = <module 'azure.mgmt.compute.v2018_10_01.models' from 'c:\\hostedtoolcache\\windows\\python\\3.6.8\\x64\\lib\\site-packages\\azure\\mgmt\\compute\\v2018_10_01\\models\\__init__.py'>