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.objectVirtualMachinesOperations
Constructor
VirtualMachinesOperations(client, config, serializer, deserializer)
Parameters
- client
Client for service requests.
- config
Configuration of service client.
- serializer
An object model serializer.
- deserializer
An object model deserializer.
Variables
- models
Alias to model classes used in this operation group.
Methods
| begin_assess_patches |
Assess patches on the VM. |
| 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. 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_install_patches |
Installs patches on the VM. |
| 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_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: |
| 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. |
| retrieve_boot_diagnostics_data |
The operation to retrieve SAS URIs for a virtual machine's boot diagnostic logs. |
| simulate_eviction |
The operation to simulate the eviction of spot virtual machine. |
begin_assess_patches
Assess patches on the VM.
begin_assess_patches(resource_group_name: str, vm_name: str, **kwargs: Any) -> LROPoller[_models.VirtualMachineAssessPatchesResult]
Parameters
- 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 VirtualMachineAssessPatchesResult or the result of cls(response)
Return type
Exceptions
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, **kwargs: Any) -> LROPoller[_models.VirtualMachineCaptureResult]
Parameters
- parameters
- VirtualMachineCaptureParameters
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
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
- 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
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: _models.VirtualMachine, **kwargs: Any) -> LROPoller[_models.VirtualMachine]
Parameters
- 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
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
- 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
begin_delete
The operation to delete a virtual machine.
begin_delete(resource_group_name: str, vm_name: str, force_deletion: Optional[bool] = None, **kwargs: Any) -> LROPoller[None]
Parameters
- force_deletion
- bool
Optional parameter to force delete virtual machines.(Feature in Preview).
- 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
begin_install_patches
Installs patches on the VM.
begin_install_patches(resource_group_name: str, vm_name: str, install_patches_input: _models.VirtualMachineInstallPatchesParameters, **kwargs: Any) -> LROPoller[_models.VirtualMachineInstallPatchesResult]
Parameters
- install_patches_input
- VirtualMachineInstallPatchesParameters
Input for InstallPatches as directly received by the API.
- 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 VirtualMachineInstallPatchesResult 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
- 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
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: Optional[bool] = False, **kwargs: Any) -> LROPoller[None]
Parameters
- skip_shutdown
- bool
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 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
begin_reapply
The operation to reapply a virtual machine's state.
begin_reapply(resource_group_name: str, vm_name: str, **kwargs: Any) -> LROPoller[None]
Parameters
- 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
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
- 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
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: Optional[_models.VirtualMachineReimageParameters] = None, **kwargs: Any) -> LROPoller[None]
Parameters
- parameters
- VirtualMachineReimageParameters
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
begin_restart
The operation to restart a virtual machine.
begin_restart(resource_group_name: str, vm_name: str, **kwargs: Any) -> LROPoller[None]
Parameters
- 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
begin_run_command
Run command on the VM.
begin_run_command(resource_group_name: str, vm_name: str, parameters: _models.RunCommandInput, **kwargs: Any) -> LROPoller[_models.RunCommandResult]
Parameters
- 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
begin_start
The operation to start a virtual machine.
begin_start(resource_group_name: str, vm_name: str, **kwargs: Any) -> LROPoller[None]
Parameters
- 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
begin_update
The operation to update a virtual machine.
begin_update(resource_group_name: str, vm_name: str, parameters: _models.VirtualMachineUpdate, **kwargs: Any) -> LROPoller[_models.VirtualMachine]
Parameters
- parameters
- VirtualMachineUpdate
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
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/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: Any) -> None
Parameters
- 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
get
Retrieves information about the model view or the instance view of a virtual machine.
get(resource_group_name: str, vm_name: str, expand: Optional[Union[str, _models.InstanceViewTypes]] = None, **kwargs: Any) -> _models.VirtualMachine
Parameters
- expand
- str or InstanceViewTypes
The expand expression to apply on the operation. 'InstanceView' retrieves a snapshot of the runtime properties of the virtual machine that is managed by the platform and can change outside of control plane operations. 'UserData' retrieves the UserData property as part of the VM model view that was provided by the user during the VM Create/Update 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
instance_view
Retrieves information about the run-time state of a virtual machine.
instance_view(resource_group_name: str, vm_name: str, **kwargs: Any) -> _models.VirtualMachineInstanceView
Parameters
- 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
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[_models.VirtualMachineListResult]
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
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: Optional[str] = None, **kwargs: Any) -> Iterable[_models.VirtualMachineListResult]
Parameters
- status_only
- str
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
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[_models.VirtualMachineSizeListResult]
Parameters
- 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
list_by_location
Gets all the virtual machines under the specified subscription for the specified location.
list_by_location(location: str, **kwargs: Any) -> Iterable[_models.VirtualMachineListResult]
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
retrieve_boot_diagnostics_data
The operation to retrieve SAS URIs for a virtual machine's boot diagnostic logs.
retrieve_boot_diagnostics_data(resource_group_name: str, vm_name: str, sas_uri_expiration_time_in_minutes: Optional[int] = None, **kwargs: Any) -> _models.RetrieveBootDiagnosticsDataResult
Parameters
- sas_uri_expiration_time_in_minutes
- int
Expiration duration in minutes for the SAS URIs with
a value between 1 to 1440 minutes. <br>:code:>><<<br>NOTE: If not specified, SAS URIs
will be generated with a default expiration duration of 120 minutes.
- cls
- callable
A custom type or function that will be passed the direct response
Returns
RetrieveBootDiagnosticsDataResult, or the result of cls(response)
Return type
Exceptions
simulate_eviction
The operation to simulate the eviction of spot virtual machine.
simulate_eviction(resource_group_name: str, vm_name: str, **kwargs: Any) -> None
Parameters
- 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
Attributes
models
models = <module 'azure.mgmt.compute.v2021_04_01.models' from 'C:\\hostedtoolcache\\windows\\Python\\3.9.13\\x64\\lib\\site-packages\\azure\\mgmt\\compute\\v2021_04_01\\models\\__init__.py'>
Feedback
Submit and view feedback for