The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
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.
The primary repo for this package is at
https://github.com/Azure/AzureRMR; please submit issues and PRs there.
It is also mirrored at the Cloudyr org at
https://github.com/cloudyr/AzureRMR. You can install the development
version of the package with
devtools::install_github("Azure/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.
See the “Authentication basics” vignette for more details on how to authenticate with AzureRMR.
library(AzureRMR)
# authenticate with Azure AD:
# - on first login to this client, call create_azure_login()
# - on subsequent logins, call get_azure_login()
<- create_azure_login()
az
# get a subscription and resource group
<- az$get_subscription("{subscription_id}")
sub <- sub$get_resource_group("rgname")
rg
# get a resource (storage account)
<- rg$get_resource(type="Microsoft.Storage/storageAccounts", name="mystorage")
stor
# method chaining works too
<- az$
stor get_subscription("{subscription_id}")$
get_resource_group("rgname")$
get_resource(type="Microsoft.Storage/storageAccounts", name="mystorage")
# create a new resource group and resource
<- sub$create_resource_group("newrgname", location="westus")
rg2
<- rg2$create_resource(type="Microsoft.Storage/storageAccounts", name="mystorage2",
stor2 kind="Storage", sku=list(name="Standard_LRS"))
# tagging
$set_tags(comment="hello world!", created_by="AzureRMR")
stor2
# role-based access control (RBAC)
# this uses the AzureGraph package to retrieve the user ID
<- AzureGraph::get_graph_login()
gr <- gr$get_user("username@aadtenant.com")
usr $add_role_assignment(usr, "Storage blob data contributor")
stor2
# pass the GUID of the principal if you don't have AzureGraph installed
$add_role_assignment("041ff2be-4eb0-11e9-8f38-394fbcd0b29d", "Storage blob data contributor") stor2
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!
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.