Virtual Machines in 'Azure'

Functionality for working with virtual machines (VMs) in Microsoft's 'Azure' cloud: <>. Includes facilities to deploy, startup, shutdown, and cleanly delete VMs and VM clusters. Deployment configurations can be highly customised, and can make use of existing resources as well as creating new ones. A selection of predefined configurations is provided to allow easy deployment of commonly used Linux and Windows images, including Data Science Virtual Machines. With a running VM, execute scripts and install optional extensions. Part of the 'AzureR' family of packages.

This is a package for interacting with virtual machines in Azure. You can deploy, start up, shut down, run scripts, deallocate and delete VMs from the R command line. A number of VM templates are included based on the Data Science Virtual Machine, but you can also deploy other templates that you supply.

AzureVM uses the tools provided by the AzureRMR package to manage VM resources and templates. The main VM R6 class wraps the deployment template, allowing easy management of all resources as a unit. You can also create a VM in exclusive mode, meaning that it sits in its own resource group.

The package supports both single VMs as well as clusters. A single VM is treated as a cluster containing only one node.

A sample workflow:

# authenticate with Resource Manager
az <- az_rm$new(tenant="xxx-xxx-xxx", app="yyy-yyy-yyy", secret="{secret goes here}")
sub1 <- az$get_subscription("5710aa44-281f-49fe-bfa6-69e66bb55b11")
# list VM sizes -- a large data frame
#         name numberOfCores osDiskSizeInMB resourceDiskSizeInMB memoryInMB maxDataDiskCount
# 1 Standard_A0             1        1047552                20480        768                1
# 2 Standard_A1             1        1047552                71680       1792                2
# 3 Standard_A2             2        1047552               138240       3584                4
# 4 Standard_A3             4        1047552               291840       7168                8
# 5 Standard_A5             2        1047552               138240      14336                4
# 6 Standard_A4             8        1047552               619520      14336               16
# ...
# create a new Ubuntu VM in an existing resource group
rg <- sub1$get_resource_group("rdev1")
key <- readLines("~/")
rdevtest <- rg$create_vm("rdevtest", username="user", passkey=key, userauth_type="key", os="Ubuntu",
#<Azure virtual machine rdevtest>
#  Operating system: Linux 
#  Exclusive resource group: FALSE
#  Domain name:
#  Status:
#             ProvisioningState PowerState
#    rdevtest         succeeded    running
#  disks: list(rdevtest)
#  id: /subscriptions/5710aa44-281f-49fe-bfa6-69e66bb55b11/resourceGroups/rdev1/providers/Microsoft.Resou ...
#  ip_address:
#  properties: list(templateHash, parameters, mode, debugSetting, provisioningState, timestamp, duration,
#    correlationId, providers, dependencies, outputs, outputResources)
#  Methods:
#    add_extension, cancel, check, delete, restart, run_deployed_command, run_script, start, stop,
#    sync_vm_status
# shut down the VM
# ... and delete it (this will take some time)
# calling create_vm() from a subscription object will create the VM in its own resource group
rdevtest2 <- sub1$create_vm("rdevtest2", username="user", passkey=key, userauth_type="key", os="Ubuntu",
# run a shell script or command remotely (will be PowerShell on a Windows VM)
rdevtest2$run_script("ifconfig > /tmp/ifc.txt")
# ... and stop it
# .. and delete it (this can be done asynchronously for a VM in its own group)

cloudyr project logo


AzureVM 1.0.0

  • Submitted to CRAN

AzureVM 0.9.0

  • Moved to cloudyr organisation

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


2.2.2 by Hong Ooi, a year ago

Report a bug at

Browse source code at

Authors: Hong Ooi [aut, cre] , Microsoft [cph]

Documentation:   PDF Manual  

Task views: Web Technologies and Services

MIT + file LICENSE license

Imports R6, AzureRMR, jsonlite

Suggests knitr, rmarkdown, testthat, parallel, AzureKeyVault, AzureVMmetadata

Suggested by AzureVMmetadata.

See at CRAN