Learn R Programming

AzureVM (version 2.2.2)

az_vm_resource: Virtual machine resource class

Description

Class representing a virtual machine resource. In general, the methods in this class should not be called directly, nor should objects be directly instantiated from it. Use the az_vm_template class for interacting with VMs instead.

Arguments

Format

An R6 object of class az_vm_resource, inheriting from AzureRMR::az_resource.

Methods

The following methods are available, in addition to those provided by the AzureRMR::az_resource class:

  • start(wait=TRUE): Start the VM. By default, wait until the startup process is complete.

  • stop(deallocate=TRUE, wait=FALSE): Stop the VM. By default, deallocate it as well.

  • restart(wait=TRUE): Restart the VM.

  • run_deployed_command(command, parameters, script): Run a PowerShell command on the VM.

  • run_script(script, parameters): Run a script on the VM. For a Linux VM, this will be a shell script; for a Windows VM, a PowerShell script. Pass the script as a character vector.

  • sync_vm_status(): Check the status of the VM.

  • resize(size, deallocate=FALSE, wait=FALSE): Resize the VM. Optionally stop and deallocate it first (may sometimes be necessary).

  • redeploy(): Redeploy the VM.

  • reimage(): Reimage the VM.

  • get_public_ip_address(nic=1, config=1): Get the public IP address of the VM. Returns NA if the VM is shut down, or is not publicly accessible.

  • get_private_ip_address(nic=1, config=1): Get the private IP address of the VM.

  • get_public_ip_resource(nic=1, config=1): Get the Azure resource for the VM's public IP address.

  • get_nic(nic=1): Get the VM's network interface resource.

  • get_vnet(nic=1, config=1): Get the VM's virtual network resource.

  • get_nsg(nic=1, config=1): Get the VM's network security group resource. Note that an NSG can be attached to either the VM's network interface or to its virtual network subnet; if there is an NSG attached to both, this method returns a list containing the two NSG resource objects.

  • get_disk(disk="os"): Get a managed disk resource attached to the VM. The disk argument can be "os" for the OS disk, or a number indicating the LUN of a data disk. AzureVM only supports managed disks.

  • add_extension(publisher, type, version, settings=list(), protected_settings=list(), key_vault_settings=list()): Add an extension to the VM.

  • do_vm_operation(...): Carry out an arbitrary operation on the VM resource. See the do_operation method of the AzureRMR::az_resource class for more details.

See Also

AzureRMR::az_resource, get_vm_resource, az_vm_template

VM API reference