# NOT RUN {
# recommended way to retrieve a subscription object
sub <- az_rm$
new(tenant="myaadtenant.onmicrosoft.com", app="app_id", password="password")$
get_subscription("subscription_id")
# retrieve list of resource group objects under this subscription
sub$list_resource_groups()
# get a resource group
sub$get_resource_group("rgname")
# check if a resource group exists, and if not, create it
rg_exists <- sub$resource_group_exists("rgname")
if(!rg_exists)
sub$create_resource_group("rgname", location="australiaeast")
# delete a resource group
sub$delete_resource_group("rgname")
# get provider API versions for some resource types
sub$get_provider_api_version("Microsoft.Compute", "virtualMachines")
sub$get_provider_api_version("Microsoft.Storage", "storageAccounts")
# }
Run the code above in your browser using DataLab