virtual_machines#

Exec module for managing Compute Virtual Machines.

async idem_azure.exec.azure.compute.virtual_machines.get(hub, ctx, resource_id: str, name: str = None, raw: bool = False) Dict[str, Any][source]#

Get compute virtual machines resource from resource_id.

Parameters:
  • resource_id (str) – The resource_id of virtual machine

  • name (str, Optional) – The name of the resource

  • raw (bool, Optional) – Returns raw response if True. Defaults to False

Returns:

Dict[str, Any]

Examples

Calling this exec module function from the cli with resource_id:

idem exec azure.compute.virtual_machines.get resource_id="value"

Using in a state:

my_unmanaged_resource:
  exec.run:
    - path:  azure.compute.virtual_machines.get
    - kwargs:
        resource_id: "/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}/providers/Microsoft.Compute/virtualMachines/{virtual_machine_name}"
async idem_azure.exec.azure.compute.virtual_machines.list_(hub, ctx) Dict[source]#

List of compute virtual machines

Returns:

Dict[str, Any]

Examples

Calling this exec module function from the cli with resource_id:

idem exec azure.compute.virtual_machines.list

Using in a state:

my_unmanaged_resource:
  exec.run:
    - path: azure.compute.virtual_machines.list
async idem_azure.exec.azure.compute.virtual_machines.power_off(hub, ctx, resource_id: str, skip_shutdown: bool = False) Dict[str, Any][source]#

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.

Parameters:
  • resource_id (str) – The resource_id of virtual machine

  • skip_shutdown (bool, Optional) – 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

Returns:

Dict[str, Any]

Examples

Calling this exec module function from the cli with resource_id:

idem exec azure.compute.virtual_machines.power_off resource_id="value"

Using in a state:

my_unmanaged_resource:
  exec.run:
    - path:  azure.compute.virtual_machines.power_off
    - kwargs:
        resource_id: "/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}/providers/Microsoft.Compute/virtualMachines/{virtual_machine_name}"
async idem_azure.exec.azure.compute.virtual_machines.start(hub, ctx, resource_id: str) Dict[str, Any][source]#

The operation to start a virtual machine.

Parameters:

resource_id (str) – The resource_id of virtual machine

Returns:

Dict[str, Any]

Examples

Calling this exec module function from the cli with resource_id:

idem exec azure.compute.virtual_machines.start resource_id="value"

Using in a state:

my_unmanaged_resource:
  exec.run:
    - path:  azure.compute.virtual_machines.start
    - kwargs:
        resource_id: "/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}/providers/Microsoft.Compute/virtualMachines/{virtual_machine_name}"
async idem_azure.exec.azure.compute.virtual_machines.restart(hub, ctx, resource_id: str) Dict[str, Any][source]#

The operation to restart a virtual machine.

Parameters:

resource_id (str) – The resource_id of virtual machine

Returns:

Dict[str, Any]

Examples

Calling this exec module function from the cli with resource_id:

idem exec azure.compute.virtual_machines.restart resource_id="value"

Using in a state:

my_unmanaged_resource:
  exec.run:
    - path:  azure.compute.virtual_machines.restart
    - kwargs:
        resource_id: "/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}/providers/Microsoft.Compute/virtualMachines/{virtual_machine_name}"
async idem_azure.exec.azure.compute.virtual_machines.deallocate(hub, ctx, resource_id: str, hibernate: bool = None) Dict[str, Any][source]#

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

Parameters:
  • resource_id (str) – The resource_id of virtual machine

  • hibernate (bool, Optional) – Optional parameter to hibernate a virtual machine. (Feature in Preview)

Returns:

Dict[str, Any]

Examples

Calling this exec module function from the cli with resource_id:

idem exec azure.compute.virtual_machines.deallocate resource_id="value"

Using in a state:

my_unmanaged_resource:
  exec.run:
    - path:  azure.compute.virtual_machines.deallocate
    - kwargs:
        resource_id: "/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}/providers/Microsoft.Compute/virtualMachines/{virtual_machine_name}"
async idem_azure.exec.azure.compute.virtual_machines.perform_maintenance(hub, ctx, resource_id: str) Dict[str, Any][source]#

The operation to perform maintenance on a virtual machine.

Parameters:

resource_id (str) – The resource_id of virtual machine

Returns:

Dict[str, Any]

Examples

Calling this exec module function from the cli with resource_id:

idem exec azure.compute.virtual_machines.perform_maintenance resource_id="value"

Using in a state:

my_unmanaged_resource:
  exec.run:
    - path:  azure.compute.virtual_machines.perform_maintenance
    - kwargs:
        resource_id: "/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}/providers/Microsoft.Compute/virtualMachines/{virtual_machine_name}"