AzureRMR v2.1.1


Monthly downloads



Interface to 'Azure Resource Manager'

A lightweight but powerful R interface to the 'Azure Resource Manager' REST API. The package exposes classes and methods for 'OAuth' authentication and working with subscriptions and resource groups. It also provides functionality for creating and deleting 'Azure' resources and deploying templates. While 'AzureRMR' can be used to manage any 'Azure' service, it can also be extended by other packages to provide extra functionality for specific services.



CRAN Downloads Travis Build Status

AzureRMR is a package for interacting with Azure Resource Manager: list subscriptions, manage resource groups, deploy and delete templates and resources. It calls the Resource Manager REST API directly, so you don't need to have PowerShell or Python installed. Azure Active Directory OAuth tokens are obtained using the AzureAuth package.

You can install the development version from GitHub, via devtools::install_github("cloudyr/AzureRMR").


Under the hood, AzureRMR uses a similar authentication process to the Azure CLI. The first time you authenticate with a given Azure Active Directory tenant, you call create_azure_login() and supply your credentials. AzureRMR will prompt you for permission to create a special data directory in which to cache the obtained authentication token and Resource Manager login. Once this information is saved on your machine, it can be retrieved in subsequent R sessions with get_azure_login(). Your credentials will be automatically refreshed so you don't have to reauthenticate.

Unless you have a specific reason otherwise, it's recommended that you allow AzureRMR to create this caching directory. Note that many other cloud engineering tools save credentials in this way, including the Azure CLI itself.

In most cases, AzureRMR can authenticate without requiring you to create your own service principal. However, AzureRMR can also use a custom service principal, and in general it's a good idea to supply your own to authenticate with (if possible). See the "Introduction to AzureRMR" vignette for more details.

Linux DSVM note If you are using a Linux Data Science Virtual Machine in Azure, you may have problems running create_azure_login(). In this case, try create_azure_login(auth_type="device_code").

Sample workflow


# authenticate with Azure AD:
# - on first login to this client, call create_azure_login()
# - on subsequent logins, call get_azure_login()
az <- create_azure_login()

# get a subscription and resource group
sub <- az$get_subscription("{subscription_id}")
rg <- sub$get_resource_group("rgname")

# get a resource (storage account)
stor <- rg$get_resource(type="Microsoft.Storage/storageAccounts", name="mystorage")

# method chaining works too
stor <- az$
    get_resource(type="Microsoft.Storage/storageAccounts", name="mystorage")

# create a new resource group and resource
rg2 <- sub$create_resource_group("newrgname", location="westus")

stor2 <- rg2$create_resource(type="Microsoft.Storage/storageAccounts", name="mystorage2",
    kind="Storage", sku=list(name="Standard_LRS"))

# tagging
stor2$set_tags(comment="hello world!", created_by="AzureRMR")

# role-based access control (RBAC)
# this uses the AzureGraph package to retrieve the user ID
gr <- AzureGraph::get_graph_login()
usr <- gr$get_user("")
stor2$add_role_assignment(usr, "Storage blob data contributor")

# pass the GUID of the principal if you don't have AzureGraph installed
stor2$add_role_assignment("041ff2be-4eb0-11e9-8f38-394fbcd0b29d", "Storage blob data contributor")


AzureRMR is meant to be a generic mechanism for working with Resource Manager. You can extend it to provide support for service-specific features; examples of packages that do this include AzureVM for virtual machines, and AzureStor for storage accounts. For more information, see the "Extending AzureRMR" vignette.


AzureRMR is inspired by the package AzureSMR, originally written by Alan Weaver and Andrie de Vries, and would not have been possible without their pioneering work. Thanks, guys!

cloudyr project logo

Functions in AzureRMR

Name Description
lock Management locks
az_template Azure template class
rbac Role-based access control (RBAC)
create_azure_login Login to Azure Resource Manager
reexports Objects exported from other packages
named_list Miscellaneous utility functions
call_azure_rm Call the Azure Resource Manager REST API
format_public_fields Format an Azure object
az_role_definition Azure role definition class
az_subscription Azure subscription class
az_role_assignment Azure role assignment class
az_rm Azure Resource Manager
az_resource_group Azure resource group class
az_resource Azure resource class
is_azure_login Informational functions
No Results!

Vignettes of AzureRMR

No Results!

Last month downloads


License MIT + file LICENSE
VignetteBuilder knitr
RoxygenNote 6.1.1
NeedsCompilation no
Packaged 2019-05-12 21:35:43 UTC; hongo
Repository CRAN
Date/Publication 2019-05-12 22:30:03 UTC

Include our badge in your README