az_resource_group {AzureRMR}R Documentation

Azure resource group class


Class representing an Azure resource group.


An R6 object of class az_resource_group.



Initializing a new object of this class can either retrieve an existing resource group, or create a new resource group on the host. Generally, the easiest way to create a resource group object is via the get_resource_group, create_resource_group or list_resource_groups methods of the az_subscription class, which handle this automatically.

To create a resource group object in isolation, supply (at least) an Oauth 2.0 token of class AzureToken, the subscription ID, and the resource group name. If this object refers to a new resource group, supply the location as well (use the list_locations method of the ⁠az_subscription class⁠ for possible locations). You can also pass any optional parameters for the resource group as named arguments to new().


To deploy a new template, pass the following arguments to deploy_template():

Retrieving or deleting a deployed template requires only the name of the deployment.


There are a number of arguments to get_resource(), create_resource() and delete_resource() that serve to identify the specific resource in question:

Providing the id argument will fill in the values for all the other arguments. Similarly, providing the type argument will fill in the values for provider and path. Unless you provide id, you must also provide name.

To create/deploy a new resource, specify any extra parameters that the provider needs as named arguments to create_resource(). Like deploy_template(), create_resource() also takes an optional wait argument that specifies whether to wait until resource creation is complete before returning.


The do_operation() method allows you to carry out arbitrary operations on the resource group. It takes the following arguments:

Consult the Azure documentation for what operations are supported.

Role-based access control

AzureRMR implements a subset of the full RBAC functionality within Azure Active Directory. You can retrieve role definitions and add and remove role assignments, at the subscription, resource group and resource levels. See rbac for more information.

See Also

az_subscription, az_template, az_resource, Azure resource group overview, Resources API reference, Template API reference

For role-based access control methods, see rbac

For management locks, see lock


## Not run: 

# recommended way to retrieve a resource group object
rg <- get_azure_login("myaadtenant")$

# list resources & templates in this resource group

# get a resource (virtual machine)
rg$get_resource(type="Microsoft.Compute/virtualMachines", name="myvm")

# create a resource (storage account)
rg$create_resource(type="Microsoft.Storage/storageAccounts", name="mystorage",

# delete a resource
rg$delete_resource(type="Microsoft.Storage/storageAccounts", name="mystorage")

# deploy a template

# deploy a template with parameters inline
    parameters=list(parm1="foo", parm2="bar"))

# delete a template and free resources
rg$delete_template("tplname", free_resources=TRUE)

# delete the resource group itself

## End(Not run)

[Package AzureRMR version 2.4.4 Index]