Learn Idem

Learn Idem

Powered by Idem Project

azure.compute.virtual_machines

**Autogenerated function**

Delete a Virtual Machine

Args:
    name(str): The identifier for this state.
    resource_group_name(str): The name of the resource group.
    virtual_machine_name(str): The name of the virtual machine.
    subscription_id(str, optional): Subscription Unique id.

Returns:
    Dict

Examples:

    .. code-block:: sls

        resource_is_absent:
          azure.compute.virtual_machines.absent:
            - name: my-vm
            - resource_group_name: my-resource-group
            - virtual_machine_name: my-vm
            - subscription_id: my-subscription
**Autogenerated function**

Describe the resource in a way that can be recreated/managed with the corresponding "present" function


List all Virtual Machines under the same subscription


Returns:
    Dict[str, Any]

Examples:

    .. code-block:: bash

        $ idem describe azure.compute.virtual_machines
**Autogenerated function**

Create or update Virtual Machines

Args:
    name(str): The identifier for this state.
    resource_group_name(str): The name of the resource group.
    resource_id(str, optional): Virtual Machine resource id on Azure
    virtual_machine_name(str): The name of the virtual machine.
    location(str): Resource location. Changing this forces a new resource to be created.
    virtual_machine_size(str): Specifies the size of the Virtual Machine.
    network_interface_ids(List[str]): A list of Network Interface IDs which should be associated with the Virtual Machine.
    subscription_id(str, optional): Subscription Unique id.
    tags(Dict, optional): Resource tags.
    os_profile(Dict): Specifies the operating system settings used while creating the virtual machine.
        computer_name(str): Specifies the name of the Virtual Machine.
        admin_username(str): Specifies the name of the local administrator account.
        admin_password(str): (Required for Windows, Optional for Linux) The password associated with the local administrator account.
    storage_image_reference(Dict): Specifies information about the image to use. Eg- platform images, marketplace images.
        image_sku(str): Specifies the SKU of the image used to create the virtual machine. Changing this forces a new resource to be created.
        image_publisher(str): Specifies the publisher of the image used to create the virtual machine. Changing this forces a new resource to be created.
        image_version(str): Specifies the version of the image used to create the virtual machine. Changing this forces a new resource to be created.
        image_offer(str, optional):  Specifies the offer of the image used to create the virtual machine. Changing this forces a new resource to be created.
    storage_os_disk(Dict): Specifies information about the operating system disk used by the virtual machine.
        disk_name(str): Specifies the name of the OS Disk.
        disk_create_option(str): Specifies how the OS Disk should be created. Possible values are Attach (managed disks only) and FromImage.
        storage_account_type(str, optional): Specifies the type of Managed Disk which should be created. Possible values are Standard_LRS, StandardSSD_LRS or Premium_LRS.
        disk_caching(str, optional): Specifies the caching requirements for the OS Disk. Possible values include None, ReadOnly and ReadWrite.
        disk_size_in_GB(str, optional): Specifies the size of the OS Disk in gigabytes.
        disk_delete_option(str, optional): Specifies how the OS Disk should be handled after VM deletion. Possible values are Detach and Delete.
        disk_id(str, optional): Specifies the ID of an existing Managed Disk which should be attached as the OS Disk of this Virtual Machine. If this is set then the create_option must be set to Attach.
    storage_data_disks(list(Dict), optional): List of Data disks attached/added to a VM.
        disk_name(str): The name of the Data Disk.
        disk_create_option(str): Specifies how the data disk should be created. Possible values are Attach, FromImage and Empty.
        disk_logical_unit_number(str): Specifies the logical unit number of the data disk. This needs to be unique within all the Data Disks on the Virtual Machine.
        storage_account_type(str, optional): Specifies the type of managed disk to create. Possible values are either Standard_LRS, StandardSSD_LRS, Premium_LRS or UltraSSD_LRS.
        disk_caching(str, optional): Specifies the caching requirements for the Data Disk. Possible values include None, ReadOnly and ReadWrite.
        disk_size_in_GB(str, optional): Specifies the size of the data disk in gigabytes.
        disk_delete_option(str, optional): Specifies how the OS Disk should be handled after VM deletion. Possible values are Detach and Delete.
        disk_id(str, optional): Specifies the ID of an Existing Managed Disk which should be attached to this Virtual Machine. When this field is set create_option must be set to Attach.

Returns:
    Dict

Examples:

    .. code-block:: sls

        resource_is_present:
          azure.compute.virtual_machines.present:
            - name: my-vm
            - resource_group_name: my-rg-1
            - virtual_machine_name: my-vm
            - location: eastus
            - virtual_machine_size: Standard_B1ls
            - network_interface_ids:
              - /subscriptions/subscription_id/resourceGroups/my-rg-1/providers/Microsoft.Network/networkInterfaces/my-nic-id-1
            - storage_image_reference:
                image_sku: 18.04-LTS
                image_publisher: Canonical
                image_version: latest
                image_offer: UbuntuServer
            - storage_os_disk:
                storage_account_type: Standard_LRS
                disk_name: my-os-disk
                disk_caching: ReadWrite
                disk_size_in_GB: 30
                disk_create_option: FromImage
                disk_delete_option: Detach
            - storage_data_disks:
              - disk_name: my-data-disk
                disk_size_in_GB: 2
                disk_logical_unit_number: 0
                disk_caching: None
                disk_create_option: Empty
                disk_delete_option: Delete
            - os_profile:
                admin_username: my-admin-username
                computer_name: machine-name
                admin_password: Vmwareadmin123!
            - tags:
                my-tag-key-1: my-tag-value-1
                my-tag-key-2: my-tag-value-2
Last updated on 20 Sep 2022
 Edit on GitHub