This commit is contained in:
Hong Ooi 2023-09-20 09:59:06 +10:00
Родитель c730d68d07
Коммит 7053eadd17
27 изменённых файлов: 68 добавлений и 60 удалений

Просмотреть файл

@ -28,4 +28,4 @@ Suggests:
httpuv,
AzureStor
Roxygen: list(markdown=TRUE, r6=FALSE, old_usage=TRUE)
RoxygenNote: 7.1.1
RoxygenNote: 7.2.1

Просмотреть файл

@ -41,12 +41,12 @@
#' @seealso
#' [az_rm], [AzureAuth::get_azure_token] for more details on authentication methods, [AzureGraph::create_graph_login] for the corresponding function to create a Microsoft Graph login client
#'
#' [Azure Resource Manager overview](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-overview),
#' [REST API reference](https://docs.microsoft.com/en-us/rest/api/resources/)
#' [Azure Resource Manager overview](https://learn.microsoft.com/en-us/azure/azure-resource-manager/resource-group-overview),
#' [REST API reference](https://learn.microsoft.com/en-us/rest/api/resources/)
#'
#' [Authentication in Azure Active Directory](https://docs.microsoft.com/en-us/azure/active-directory/develop/authentication-scenarios)
#' [Authentication in Azure Active Directory](https://learn.microsoft.com/en-us/azure/active-directory/develop/authentication-scenarios)
#'
#' [Azure CLI documentation](https://docs.microsoft.com/en-us/cli/azure/?view=azure-cli-latest)
#' [Azure CLI documentation](https://learn.microsoft.com/en-us/cli/azure/?view=azure-cli-latest)
#'
#' @examples
#' \dontrun{

Просмотреть файл

@ -7,7 +7,7 @@
#' - `new(token, subscription, id, ...)`: Initialize a resource group object. See 'Initialization' for more details.
#' - `delete(confirm=TRUE)`: Delete this resource group, after a confirmation check. This is asynchronous: while the method returns immediately, the delete operation continues on the host in the background. For resource groups containing a large number of deployed resources, this may take some time to complete.
#' - `sync_fields()`: Synchronise the R object with the resource group it represents in Azure.
#' - `list_templates(filter, top)`: List deployed templates in this resource group. `filter` and `top` are optional arguments to filter the results; see the [Azure documentation](https://docs.microsoft.com/en-us/rest/api/resources/deployments/listbyresourcegroup) for more details. If `top` is specified, the returned list will have a maximum of this many items.
#' - `list_templates(filter, top)`: List deployed templates in this resource group. `filter` and `top` are optional arguments to filter the results; see the [Azure documentation](https://learn.microsoft.com/en-us/rest/api/resources/deployments/listbyresourcegroup) for more details. If `top` is specified, the returned list will have a maximum of this many items.
#' - `get_template(name)`: Return an object representing an existing template.
#' - `deploy_template(...)`: Deploy a new template. See 'Templates' for more details. By default, AzureRMR will set the `createdBy` tag on a newly-deployed template to the value `AzureR/AzureRMR`.
#' - `delete_template(name, confirm=TRUE, free_resources=FALSE)`: Delete a deployed template, and optionally free any resources that were created.
@ -15,7 +15,7 @@
#' - `create_resource(...)`: Create a new resource. By default, AzureRMR will set the `createdBy` tag on a newly-created resource to the value `AzureR/AzureRMR`.
#' - `delete_resource(..., confirm=TRUE, wait=FALSE)`: Delete an existing resource. Optionally wait for the delete to finish.
#' - `resource_exists(...)`: Check if a resource exists.
#' - `list_resources(filter, expand, top)`: Return a list of resource group objects for this subscription. `filter`, `expand` and `top` are optional arguments to filter the results; see the [Azure documentation](https://docs.microsoft.com/en-us/rest/api/resources/resources/list) for more details. If `top` is specified, the returned list will have a maximum of this many items.
#' - `list_resources(filter, expand, top)`: Return a list of resource group objects for this subscription. `filter`, `expand` and `top` are optional arguments to filter the results; see the [Azure documentation](https://learn.microsoft.com/en-us/rest/api/resources/resources/list) for more details. If `top` is specified, the returned list will have a maximum of this many items.
#' - `do_operation(...)`: Carry out an operation. See 'Operations' for more details.
#' - `set_tags(..., keep_existing=TRUE)`: Set the tags on this resource group. The tags can be either names or name-value pairs. To delete a tag, set it to `NULL`.
#' - `get_tags()`: Get the tags on this resource group.
@ -74,9 +74,9 @@
#'
#' @seealso
#' [az_subscription], [az_template], [az_resource],
#' [Azure resource group overview](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-overview#resource-groups),
#' [Resources API reference](https://docs.microsoft.com/en-us/rest/api/resources/resources),
#' [Template API reference](https://docs.microsoft.com/en-us/rest/api/resources/deployments)
#' [Azure resource group overview](https://learn.microsoft.com/en-us/azure/azure-resource-manager/resource-group-overview#resource-groups),
#' [Resources API reference](https://learn.microsoft.com/en-us/rest/api/resources/resources),
#' [Template API reference](https://learn.microsoft.com/en-us/rest/api/resources/deployments)
#'
#' For role-based access control methods, see [rbac]
#'

Просмотреть файл

@ -73,7 +73,7 @@
#'
#' @seealso
#' [az_resource_group], [call_azure_rm], [call_azure_url],
#' [Resources API reference](https://docs.microsoft.com/en-us/rest/api/resources/resources)
#' [Resources API reference](https://learn.microsoft.com/en-us/rest/api/resources/resources)
#'
#' For role-based access control methods, see [rbac]
#'

Просмотреть файл

@ -41,8 +41,8 @@
#' @seealso
#' [create_azure_login], [get_azure_login]
#'
#' [Azure Resource Manager overview](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-overview),
#' [REST API reference](https://docs.microsoft.com/en-us/rest/api/resources/)
#' [Azure Resource Manager overview](https://learn.microsoft.com/en-us/azure/azure-resource-manager/resource-group-overview),
#' [REST API reference](https://learn.microsoft.com/en-us/rest/api/resources/)
#'
#' @examples
#' \dontrun{

Просмотреть файл

@ -18,7 +18,7 @@
#' @seealso
#' [get_role_definition], [get_role_assignment], [az_role_assignment]
#'
#' [Overview of role-based access control](https://docs.microsoft.com/en-us/azure/role-based-access-control/overview)
#' [Overview of role-based access control](https://learn.microsoft.com/en-us/azure/role-based-access-control/overview)
#'
#' @format An R6 object of class `az_role_definition`.
#' @export
@ -72,7 +72,7 @@ public=list(
#' @seealso
#' [add_role_assignment], [get_role_assignment], [get_role_definition], [az_role_definition]
#'
#' [Overview of role-based access control](https://docs.microsoft.com/en-us/azure/role-based-access-control/overview)
#' [Overview of role-based access control](https://learn.microsoft.com/en-us/azure/role-based-access-control/overview)
#'
#' @format An R6 object of class `az_role_assignment`.
#' @export

Просмотреть файл

@ -7,12 +7,12 @@
#' @docType class
#' @section Methods:
#' - `new(token, id, ...)`: Initialize a subscription object.
#' - `list_resource_groups(filter, top)`: Return a list of resource group objects for this subscription. `filter` and `top` are optional arguments to filter the results; see the [Azure documentation](https://docs.microsoft.com/en-us/rest/api/resources/resourcegroups/list) for more details. If `top` is specified, the returned list will have a maximum of this many items.
#' - `list_resource_groups(filter, top)`: Return a list of resource group objects for this subscription. `filter` and `top` are optional arguments to filter the results; see the [Azure documentation](https://learn.microsoft.com/en-us/rest/api/resources/resourcegroups/list) for more details. If `top` is specified, the returned list will have a maximum of this many items.
#' - `get_resource_group(name)`: Return an object representing an existing resource group.
#' - `create_resource_group(name, location)`: Create a new resource group in the specified region/location, and return an object representing it. By default, AzureRMR will set the `createdBy` tag on a newly-created resource group to the value `AzureR/AzureRMR`.
#' - `delete_resource_group(name, confirm=TRUE)`: Delete a resource group, after asking for confirmation.
#' - `resource_group_exists(name)`: Check if a resource group exists.
#' - `list_resources(filter, expand, top)`: List all resources deployed under this subscription. `filter`, `expand` and `top` are optional arguments to filter the results; see the [Azure documentation](https://docs.microsoft.com/en-us/rest/api/resources/resources/list) for more details. If `top` is specified, the returned list will have a maximum of this many items.
#' - `list_resources(filter, expand, top)`: List all resources deployed under this subscription. `filter`, `expand` and `top` are optional arguments to filter the results; see the [Azure documentation](https://learn.microsoft.com/en-us/rest/api/resources/resources/list) for more details. If `top` is specified, the returned list will have a maximum of this many items.
#' - `list_locations(info=c("partial", "all"))`: List locations available. The default `info="partial"` returns a subset of the information about each location; set `info="all"` to return everything.
#' - `get_provider_api_version(provider, type, which=1, stable_only=TRUE)`: Get the current API version for the given resource provider and type. If no resource type is supplied, returns a vector of API versions, one for each resource type for the given provider. If neither provider nor type is supplied, returns the API versions for all resources and providers. Set `stable_only=FALSE` to allow preview APIs to be returned. Set `which` to a number > 1 to return an API other than the most recent.
#' - `do_operation(...)`: Carry out an operation. See 'Operations' for more details.
@ -44,7 +44,7 @@
#' 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.
#'
#' @seealso
#' [Azure Resource Manager overview](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-overview)
#' [Azure Resource Manager overview](https://learn.microsoft.com/en-us/azure/azure-resource-manager/resource-group-overview)
#'
#' For role-based access control methods, see [rbac]
#'

Просмотреть файл

@ -33,8 +33,8 @@
#'
#' @seealso
#' [az_resource_group], [az_resource], [build_template_definition], [build_template_parameters]
#' [Template overview](https://docs.microsoft.com/en-us/azure/templates/),
#' [Template API reference](https://docs.microsoft.com/en-us/rest/api/resources/deployments)
#' [Template overview](https://learn.microsoft.com/en-us/azure/templates/),
#' [Template API reference](https://learn.microsoft.com/en-us/rest/api/resources/deployments)
#'
#' @examples
#' \dontrun{

Просмотреть файл

@ -25,7 +25,7 @@
#' @seealso
#' [az_template], [jsonlite::toJSON]
#'
#' [Guide to template syntax](https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/template-syntax)
#' [Guide to template syntax](https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/template-syntax)
#' @examples
#' # dummy example
#' # note that 'resources' arg should be a _list_ of resources

Просмотреть файл

@ -34,7 +34,7 @@
#' @seealso
#' [rbac]
#'
#' [Overview of management locks](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-lock-resources)
#' [Overview of management locks](https://learn.microsoft.com/en-us/azure/azure-resource-manager/resource-group-lock-resources)
#'
#' @examples
#' \dontrun{

Просмотреть файл

@ -40,7 +40,7 @@
#' @seealso
#' [az_rm], [az_role_definition], [az_role_assignment]
#'
#' [Overview of role-based access control](https://docs.microsoft.com/en-us/azure/role-based-access-control/overview)
#' [Overview of role-based access control](https://learn.microsoft.com/en-us/azure/role-based-access-control/overview)
#'
#' @examples
#' \dontrun{

Просмотреть файл

@ -4,13 +4,13 @@
![Downloads](https://cranlogs.r-pkg.org/badges/AzureRMR)
![R-CMD-check](https://github.com/Azure/AzureRMR/workflows/R-CMD-check/badge.svg)
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](https://docs.microsoft.com/en-us/rest/api/resources) directly, so you don't need to have PowerShell or Python installed. Azure Active Directory OAuth tokens are obtained using the [AzureAuth](https://github.com/Azure/AzureAuth) package.
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](https://learn.microsoft.com/en-us/rest/api/resources) directly, so you don't need to have PowerShell or Python installed. Azure Active Directory OAuth tokens are obtained using the [AzureAuth](https://github.com/Azure/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")`.
## Authentication
Under the hood, AzureRMR uses a similar authentication process to the [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/?view=azure-cli-latest). 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.
Under the hood, AzureRMR uses a similar authentication process to the [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/?view=azure-cli-latest). 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.

Просмотреть файл

@ -82,8 +82,10 @@ Consult the Azure documentation for your resource to find out what operations ar
Some resource types can have sub-resources: objects exposed by Resource Manager that make up a part of their parent's functionality. For example, a storage account (type \code{Microsoft.Storage/storageAccounts}) provides the blob storage service, which can be accessed via Resource Manager as a sub-resource of type \code{Microsoft.Storage/storageAccounts/blobServices/default}.
To retrieve an existing sub-resource, use the \code{get_subresource()} method. You do not need to include the parent resource's type and name. For example, if \code{res} is a resource for a storage account, and you want to retrieve the sub-resource for the blob container "myblobs", call\preformatted{res$get_subresource(type="blobServices/default/containers", name="myblobs")
}
To retrieve an existing sub-resource, use the \code{get_subresource()} method. You do not need to include the parent resource's type and name. For example, if \code{res} is a resource for a storage account, and you want to retrieve the sub-resource for the blob container "myblobs", call
\if{html}{\out{<div class="sourceCode">}}\preformatted{res$get_subresource(type="blobServices/default/containers", name="myblobs")
}\if{html}{\out{</div>}}
Notice that the storage account's resource type and name are omitted from the \code{get_subresource} arguments. Similarly, to create a new subresource, call the \code{create_subresource()} method with the same naming convention, passing any required fields as named arguments; and to delete it, call \code{delete_subresource()}.
}
@ -146,7 +148,7 @@ stor$delete()
}
\seealso{
\link{az_resource_group}, \link{call_azure_rm}, \link{call_azure_url},
\href{https://docs.microsoft.com/en-us/rest/api/resources/resources}{Resources API reference}
\href{https://learn.microsoft.com/en-us/rest/api/resources/resources}{Resources API reference}
For role-based access control methods, see \link{rbac}

Просмотреть файл

@ -16,7 +16,7 @@ Class representing an Azure resource group.
\item \code{new(token, subscription, id, ...)}: Initialize a resource group object. See 'Initialization' for more details.
\item \code{delete(confirm=TRUE)}: Delete this resource group, after a confirmation check. This is asynchronous: while the method returns immediately, the delete operation continues on the host in the background. For resource groups containing a large number of deployed resources, this may take some time to complete.
\item \code{sync_fields()}: Synchronise the R object with the resource group it represents in Azure.
\item \code{list_templates(filter, top)}: List deployed templates in this resource group. \code{filter} and \code{top} are optional arguments to filter the results; see the \href{https://docs.microsoft.com/en-us/rest/api/resources/deployments/listbyresourcegroup}{Azure documentation} for more details. If \code{top} is specified, the returned list will have a maximum of this many items.
\item \code{list_templates(filter, top)}: List deployed templates in this resource group. \code{filter} and \code{top} are optional arguments to filter the results; see the \href{https://learn.microsoft.com/en-us/rest/api/resources/deployments/listbyresourcegroup}{Azure documentation} for more details. If \code{top} is specified, the returned list will have a maximum of this many items.
\item \code{get_template(name)}: Return an object representing an existing template.
\item \code{deploy_template(...)}: Deploy a new template. See 'Templates' for more details. By default, AzureRMR will set the \code{createdBy} tag on a newly-deployed template to the value \code{AzureR/AzureRMR}.
\item \code{delete_template(name, confirm=TRUE, free_resources=FALSE)}: Delete a deployed template, and optionally free any resources that were created.
@ -24,7 +24,7 @@ Class representing an Azure resource group.
\item \code{create_resource(...)}: Create a new resource. By default, AzureRMR will set the \code{createdBy} tag on a newly-created resource to the value \code{AzureR/AzureRMR}.
\item \code{delete_resource(..., confirm=TRUE, wait=FALSE)}: Delete an existing resource. Optionally wait for the delete to finish.
\item \code{resource_exists(...)}: Check if a resource exists.
\item \code{list_resources(filter, expand, top)}: Return a list of resource group objects for this subscription. \code{filter}, \code{expand} and \code{top} are optional arguments to filter the results; see the \href{https://docs.microsoft.com/en-us/rest/api/resources/resources/list}{Azure documentation} for more details. If \code{top} is specified, the returned list will have a maximum of this many items.
\item \code{list_resources(filter, expand, top)}: Return a list of resource group objects for this subscription. \code{filter}, \code{expand} and \code{top} are optional arguments to filter the results; see the \href{https://learn.microsoft.com/en-us/rest/api/resources/resources/list}{Azure documentation} for more details. If \code{top} is specified, the returned list will have a maximum of this many items.
\item \code{do_operation(...)}: Carry out an operation. See 'Operations' for more details.
\item \code{set_tags(..., keep_existing=TRUE)}: Set the tags on this resource group. The tags can be either names or name-value pairs. To delete a tag, set it to \code{NULL}.
\item \code{get_tags()}: Get the tags on this resource group.
@ -144,9 +144,9 @@ rg$delete()
}
\seealso{
\link{az_subscription}, \link{az_template}, \link{az_resource},
\href{https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-overview#resource-groups}{Azure resource group overview},
\href{https://docs.microsoft.com/en-us/rest/api/resources/resources}{Resources API reference},
\href{https://docs.microsoft.com/en-us/rest/api/resources/deployments}{Template API reference}
\href{https://learn.microsoft.com/en-us/azure/azure-resource-manager/resource-group-overview#resource-groups}{Azure resource group overview},
\href{https://learn.microsoft.com/en-us/rest/api/resources/resources}{Resources API reference},
\href{https://learn.microsoft.com/en-us/rest/api/resources/deployments}{Template API reference}
For role-based access control methods, see \link{rbac}

Просмотреть файл

@ -78,6 +78,6 @@ az$get_subscription("subscription_id")
\seealso{
\link{create_azure_login}, \link{get_azure_login}
\href{https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-overview}{Azure Resource Manager overview},
\href{https://docs.microsoft.com/en-us/rest/api/resources/}{REST API reference}
\href{https://learn.microsoft.com/en-us/azure/azure-resource-manager/resource-group-overview}{Azure Resource Manager overview},
\href{https://learn.microsoft.com/en-us/rest/api/resources/}{REST API reference}
}

Просмотреть файл

@ -39,5 +39,5 @@ Technically role assignments and role definitions are Azure \emph{resources}, an
\seealso{
\link{add_role_assignment}, \link{get_role_assignment}, \link{get_role_definition}, \link{az_role_definition}
\href{https://docs.microsoft.com/en-us/azure/role-based-access-control/overview}{Overview of role-based access control}
\href{https://learn.microsoft.com/en-us/azure/role-based-access-control/overview}{Overview of role-based access control}
}

Просмотреть файл

@ -35,5 +35,5 @@ Technically role assignments and role definitions are Azure \emph{resources}, an
\seealso{
\link{get_role_definition}, \link{get_role_assignment}, \link{az_role_assignment}
\href{https://docs.microsoft.com/en-us/azure/role-based-access-control/overview}{Overview of role-based access control}
\href{https://learn.microsoft.com/en-us/azure/role-based-access-control/overview}{Overview of role-based access control}
}

Просмотреть файл

@ -14,12 +14,12 @@ Class representing an Azure subscription.
\itemize{
\item \code{new(token, id, ...)}: Initialize a subscription object.
\item \code{list_resource_groups(filter, top)}: Return a list of resource group objects for this subscription. \code{filter} and \code{top} are optional arguments to filter the results; see the \href{https://docs.microsoft.com/en-us/rest/api/resources/resourcegroups/list}{Azure documentation} for more details. If \code{top} is specified, the returned list will have a maximum of this many items.
\item \code{list_resource_groups(filter, top)}: Return a list of resource group objects for this subscription. \code{filter} and \code{top} are optional arguments to filter the results; see the \href{https://learn.microsoft.com/en-us/rest/api/resources/resourcegroups/list}{Azure documentation} for more details. If \code{top} is specified, the returned list will have a maximum of this many items.
\item \code{get_resource_group(name)}: Return an object representing an existing resource group.
\item \code{create_resource_group(name, location)}: Create a new resource group in the specified region/location, and return an object representing it. By default, AzureRMR will set the \code{createdBy} tag on a newly-created resource group to the value \code{AzureR/AzureRMR}.
\item \code{delete_resource_group(name, confirm=TRUE)}: Delete a resource group, after asking for confirmation.
\item \code{resource_group_exists(name)}: Check if a resource group exists.
\item \code{list_resources(filter, expand, top)}: List all resources deployed under this subscription. \code{filter}, \code{expand} and \code{top} are optional arguments to filter the results; see the \href{https://docs.microsoft.com/en-us/rest/api/resources/resources/list}{Azure documentation} for more details. If \code{top} is specified, the returned list will have a maximum of this many items.
\item \code{list_resources(filter, expand, top)}: List all resources deployed under this subscription. \code{filter}, \code{expand} and \code{top} are optional arguments to filter the results; see the \href{https://learn.microsoft.com/en-us/rest/api/resources/resources/list}{Azure documentation} for more details. If \code{top} is specified, the returned list will have a maximum of this many items.
\item \code{list_locations(info=c("partial", "all"))}: List locations available. The default \code{info="partial"} returns a subset of the information about each location; set \code{info="all"} to return everything.
\item \code{get_provider_api_version(provider, type, which=1, stable_only=TRUE)}: Get the current API version for the given resource provider and type. If no resource type is supplied, returns a vector of API versions, one for each resource type for the given provider. If neither provider nor type is supplied, returns the API versions for all resources and providers. Set \code{stable_only=FALSE} to allow preview APIs to be returned. Set \code{which} to a number > 1 to return an API other than the most recent.
\item \code{do_operation(...)}: Carry out an operation. See 'Operations' for more details.
@ -33,6 +33,7 @@ Class representing an Azure subscription.
\item \code{list_role_assignments()}: Lists role assignments.
\item \code{get_role_definition(id)}: Retrieves an existing role definition.
\item \code{list_role_definitions()} Lists role definitions.
\item \code{get_tags()} Get the tags on this subscription.
}
}
@ -87,7 +88,7 @@ sub$get_provider_api_version("Microsoft.Storage", "storageAccounts")
}
}
\seealso{
\href{https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-overview}{Azure Resource Manager overview}
\href{https://learn.microsoft.com/en-us/azure/azure-resource-manager/resource-group-overview}{Azure Resource Manager overview}
For role-based access control methods, see \link{rbac}

Просмотреть файл

@ -72,6 +72,6 @@ tpl$delete(free_resources=TRUE)
}
\seealso{
\link{az_resource_group}, \link{az_resource}, \link{build_template_definition}, \link{build_template_parameters}
\href{https://docs.microsoft.com/en-us/azure/templates/}{Template overview},
\href{https://docs.microsoft.com/en-us/rest/api/resources/deployments}{Template API reference}
\href{https://learn.microsoft.com/en-us/azure/templates/}{Template overview},
\href{https://learn.microsoft.com/en-us/rest/api/resources/deployments}{Template API reference}
}

Просмотреть файл

@ -104,10 +104,10 @@ az <- create_azure_login(config_file="~/creds.json")
\seealso{
\link{az_rm}, \link[AzureAuth:get_azure_token]{AzureAuth::get_azure_token} for more details on authentication methods, \link[AzureGraph:graph_login]{AzureGraph::create_graph_login} for the corresponding function to create a Microsoft Graph login client
\href{https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-overview}{Azure Resource Manager overview},
\href{https://docs.microsoft.com/en-us/rest/api/resources/}{REST API reference}
\href{https://learn.microsoft.com/en-us/azure/azure-resource-manager/resource-group-overview}{Azure Resource Manager overview},
\href{https://learn.microsoft.com/en-us/rest/api/resources/}{REST API reference}
\href{https://docs.microsoft.com/en-us/azure/active-directory/develop/authentication-scenarios}{Authentication in Azure Active Directory}
\href{https://learn.microsoft.com/en-us/azure/active-directory/develop/authentication-scenarios}{Authentication in Azure Active Directory}
\href{https://docs.microsoft.com/en-us/cli/azure/?view=azure-cli-latest}{Azure CLI documentation}
\href{https://learn.microsoft.com/en-us/cli/azure/?view=azure-cli-latest}{Azure CLI documentation}
}

Просмотреть файл

@ -161,5 +161,5 @@ build_template_parameters(name="myres_name", complex_type=file("myres_params.jso
\seealso{
\link{az_template}, \link[jsonlite:fromJSON]{jsonlite::toJSON}
\href{https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/template-syntax}{Guide to template syntax}
\href{https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/template-syntax}{Guide to template syntax}
}

Просмотреть файл

@ -11,14 +11,16 @@
Create, retrieve and delete locks. These are methods for the \code{az_subscription}, \code{az_resource_group} and \code{az_resource} classes.
}
\section{Usage}{
\preformatted{create_lock(name, level = c("cannotdelete", "readonly"), notes = "")
\if{html}{\out{<div class="sourceCode">}}\preformatted{create_lock(name, level = c("cannotdelete", "readonly"), notes = "")
get_lock(name)
delete_lock(name)
list_locks()
}
}\if{html}{\out{</div>}}
}
\section{Arguments}{
@ -74,5 +76,5 @@ res$delete()
\seealso{
\link{rbac}
\href{https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-lock-resources}{Overview of management locks}
\href{https://learn.microsoft.com/en-us/azure/azure-resource-manager/resource-group-lock-resources}{Overview of management locks}
}

Просмотреть файл

@ -13,7 +13,9 @@
Basic methods for RBAC: manage role assignments and retrieve role definitions. These are methods for the \code{az_subscription}, \code{az_resource_group} and \code{az_resource} classes.
}
\section{Usage}{
\preformatted{add_role_assignment(principal, role, scope = NULL)
\if{html}{\out{<div class="sourceCode">}}\preformatted{add_role_assignment(principal, role, scope = NULL)
get_role_assignment(id)
@ -24,7 +26,7 @@ list_role_assignments(filter = "atScope()", as_data_frame = TRUE)
get_role_definition(id)
list_role_definitions(filter=NULL, as_data_frame = TRUE)
}
}\if{html}{\out{</div>}}
}
\section{Arguments}{
@ -90,5 +92,5 @@ sub$remove_role_assignment(asn1$id)
\seealso{
\link{az_rm}, \link{az_role_definition}, \link{az_role_assignment}
\href{https://docs.microsoft.com/en-us/azure/role-based-access-control/overview}{Overview of role-based access control}
\href{https://learn.microsoft.com/en-us/azure/role-based-access-control/overview}{Overview of role-based access control}
}

Просмотреть файл

@ -7,7 +7,8 @@
\usage{
is_url(x, https_only = FALSE)
get_paged_list(lst, token, next_link_name = "nextLink", value_name = "value")
get_paged_list(lst, token, next_link_name = "nextLink",
value_name = "value")
}
\arguments{
\item{x}{For \code{is_url}, An R object.}

Просмотреть файл

@ -87,7 +87,7 @@ You can create a new app registration using any of the usual methods. For exampl
Once the app registration has been created, note the app ID and, if applicable, the client secret. The latter can't be viewed after app creation, so make sure you note its value now.
It's also possible to authenticate with a **client certificate (public key)**, but this is more complex and we won't go into it here. For more details, see the [Azure Active Directory documentation](https://docs.microsoft.com/en-au/azure/active-directory/develop/v2-oauth2-client-creds-grant-flow) and the [AzureAuth intro vignette](https://cran.r-project.org/package=AzureAuth/vignettes/token.html).
It's also possible to authenticate with a **client certificate (public key)**, but this is more complex and we won't go into it here. For more details, see the [Azure Active Directory documentation](https://learn.microsoft.com/en-au/azure/active-directory/develop/v2-oauth2-client-creds-grant-flow) and the [AzureAuth intro vignette](https://cran.r-project.org/package=AzureAuth/vignettes/token.html).
### Set the app role and scope

Просмотреть файл

@ -8,7 +8,7 @@ vignette: >
%\VignetteEncoding{utf8}
---
AzureRMR is a package for interacting with Azure Resource Manager: authenticate, list subscriptions, manage resource groups, deploy and delete templates and resources. It calls the Resource Manager [REST API](https://docs.microsoft.com/en-us/rest/api/resources) directly, so you don't need to have PowerShell or Python installed.
AzureRMR is a package for interacting with Azure Resource Manager: authenticate, list subscriptions, manage resource groups, deploy and delete templates and resources. It calls the Resource Manager [REST API](https://learn.microsoft.com/en-us/rest/api/resources) directly, so you don't need to have PowerShell or Python installed.
As a general-purpose interface to Azure Resource Manager (ARM), you can use AzureRMR to work with nearly any Azure object that ARM can handle: subscriptions, resource groups, resources, templates and so on. The things you can do include:
@ -22,7 +22,7 @@ As a general-purpose interface to Azure Resource Manager (ARM), you can use Azur
## Authentication
Under the hood, AzureRMR uses a similar authentication process to the [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/?view=azure-cli-latest). The first time you authenticate with a given Azure Active Directory tenant, you call `create_azure_login()`, which will log you into Azure. R will prompt you for permission to create a special data directory in which to save your credentials. 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.
Under the hood, AzureRMR uses a similar authentication process to the [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/?view=azure-cli-latest). The first time you authenticate with a given Azure Active Directory tenant, you call `create_azure_login()`, which will log you into Azure. R will prompt you for permission to create a special data directory in which to save your credentials. 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 good reason otherwise, you should allow this caching directory to be created. Note that many other cloud engineering tools save credentials in this way, including the Azure CLI itself. You can see the location of the caching directory with the function `AzureR_dir()`.
@ -191,7 +191,7 @@ vm$do_operation("runCommand",
vm$do_operation("powerOff", http_verb="POST")
```
For the types of operations you can carry out on a resource, consult the [Azure REST API documentation](https://docs.microsoft.com/en-us/rest/api/?view=Azure).
For the types of operations you can carry out on a resource, consult the [Azure REST API documentation](https://learn.microsoft.com/en-us/rest/api/?view=Azure).
You can also interrogate the fields of a resource object; in particular the `properties` field can contain arbitrary information about an Azure resource. For example, a storage account's properties includes the endpoint URIs, and a virtual machine's properties includes its admin login details.
@ -256,7 +256,7 @@ rg$delete_lock("mylock")
### Role-based access control
As of version 2.1.0, AzureRMR includes limited support for [role-based access control](https://docs.microsoft.com/en-us/azure/role-based-access-control/overview) (RBAC). You can read role definitions, and read, add and remove role assignments. This applies to subscription, resource group and resource objects.
As of version 2.1.0, AzureRMR includes limited support for [role-based access control](https://learn.microsoft.com/en-us/azure/role-based-access-control/overview) (RBAC). You can read role definitions, and read, add and remove role assignments. This applies to subscription, resource group and resource objects.
```r
rg$list_role_definitions()

Просмотреть файл

@ -8,7 +8,7 @@ vignette: >
%\VignetteEncoding{utf8}
---
An Azure [template](https://docs.microsoft.com/en-us/azure/azure-resource-manager/template-deployment-overview) is a JSON file that can be used to automate the deployment of a set of related resources. The template uses declarative syntax, which lets you state what you intend to deploy without having to write the sequence of programming commands to create it. In the template, you specify the resources to deploy and the properties for those resources.
An Azure [template](https://learn.microsoft.com/en-us/azure/azure-resource-manager/template-deployment-overview) is a JSON file that can be used to automate the deployment of a set of related resources. The template uses declarative syntax, which lets you state what you intend to deploy without having to write the sequence of programming commands to create it. In the template, you specify the resources to deploy and the properties for those resources.
Deploying a template with AzureRMR is just a matter of calling a resource group object's `deploy_template` method. This takes two arguments, `template` and `parameters`. `deploy_template` is very flexible in how you can specify its arguments: