diff --git a/.Rbuildignore b/.Rbuildignore index 51404c7..5b63e79 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -9,3 +9,4 @@ CONTRIBUTING.md drat.sh ^LICENSE\.md$ ^\.github$ +^SECURITY\.md$ diff --git a/.github/workflows/check-standard.yaml b/.github/workflows/check-standard.yaml index ecfd12b..3f5b2ce 100644 --- a/.github/workflows/check-standard.yaml +++ b/.github/workflows/check-standard.yaml @@ -17,19 +17,19 @@ jobs: config: - {os: windows-latest, r: 'release'} - {os: macOS-latest, r: 'release'} - - {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} + - {os: ubuntu-24.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} env: R_REMOTES_NO_ERRORS_FROM_WARNINGS: true RSPM: ${{ matrix.config.rspm }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: fetch-depth: 0 # required for mirroring, see https://stackoverflow.com/a/64272409/474349 - name: Copy to Cloudyr - if: runner.os == 'Linux' && github.ref == 'refs/heads/master' && github.repository_owner == 'Azure' + if: github.repository_owner == 'Azure' && runner.os == 'Linux' && github.ref == 'refs/heads/master' env: token: "${{ secrets.ghPat }}" # git config hack required, see https://stackoverflow.com/q/64270867/474349 @@ -54,11 +54,11 @@ jobs: - name: Cache R packages if: runner.os != 'Windows' - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ${{ env.R_LIBS_USER }} key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} - restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- + # restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-5- - name: Install system dependencies if: runner.os == 'Linux' @@ -85,13 +85,13 @@ jobs: - name: Upload check results if: failure() - uses: actions/upload-artifact@main + uses: actions/upload-artifact@v4 with: name: ${{ runner.os }}-r${{ matrix.config.r }}-results path: check - name: Update Cloudyr drat - if: success() && runner.os == 'Linux' && github.ref == 'refs/heads/master' && github.repository_owner == 'Azure' + if: success() && github.repository_owner == 'Azure' && runner.os == 'Linux' && github.ref == 'refs/heads/master' env: token: "${{ secrets.ghPat }}" run: | diff --git a/DESCRIPTION b/DESCRIPTION index 3871b8c..eed78b2 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AzureRMR Title: Interface to 'Azure Resource Manager' -Version: 2.4.4 +Version: 2.4.5 Authors@R: c( person("Hong", "Ooi", , "hongooi73@gmail.com", role = c("aut", "cre")), person("Microsoft", role="cph") @@ -28,4 +28,4 @@ Suggests: httpuv, AzureStor Roxygen: list(markdown=TRUE, r6=FALSE, old_usage=TRUE) -RoxygenNote: 7.2.1 +RoxygenNote: 7.3.1 diff --git a/NAMESPACE b/NAMESPACE index 593d2fb..130e087 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -50,4 +50,16 @@ export(pool_sapply) export(pool_size) import(AzureAuth) import(AzureGraph) +importFrom(AzureAuth,AzureR_dir) +importFrom(AzureAuth,clean_token_directory) +importFrom(AzureAuth,delete_azure_token) +importFrom(AzureAuth,get_azure_token) +importFrom(AzureAuth,is_azure_token) +importFrom(AzureAuth,is_azure_v1_token) +importFrom(AzureAuth,is_guid) +importFrom(AzureAuth,list_azure_tokens) +importFrom(AzureGraph,format_public_fields) +importFrom(AzureGraph,format_public_methods) +importFrom(AzureGraph,is_empty) +importFrom(AzureGraph,named_list) importFrom(utils,modifyList) diff --git a/NEWS.md b/NEWS.md index 11075e3..0a9a032 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# AzureRMR 2.4.5 + +- Update documentation links for CRAN + # AzureRMR 2.4.4 - Fix broken `list_azure_logins` function. Thanks to Pedro Z (@pedrobtz). diff --git a/R/az_login.R b/R/az_login.R index 25560b3..0758f21 100644 --- a/R/az_login.R +++ b/R/az_login.R @@ -11,7 +11,7 @@ #' @param version The Azure Active Directory version to use for authenticating. #' @param scopes The Azure Service Management scopes (permissions) to obtain for this login. Only for `version=2`. #' @param config_file Optionally, a JSON file containing any of the arguments listed above. Arguments supplied in this file take priority over those supplied on the command line. You can also use the output from the Azure CLI `az ad sp create-for-rbac` command. -#' @param token Optionally, an OAuth 2.0 token, of class [AzureToken]. This allows you to reuse the authentication details for an existing session. If supplied, the other arguments above to `create_azure_login` will be ignored. +#' @param token Optionally, an OAuth 2.0 token, of class [AzureAuth::AzureToken]. This allows you to reuse the authentication details for an existing session. If supplied, the other arguments above to `create_azure_login` will be ignored. #' @param graph_host The Microsoft Graph endpoint. See 'Microsoft Graph integration' below. #' @param refresh For `get_azure_login`, whether to refresh the authentication token on loading the client. #' @param selection For `get_azure_login`, if you have multiple logins for a given tenant, which one to use. This can be a number, or the input MD5 hash of the token used for the login. If not supplied, `get_azure_login` will print a menu and ask you to choose a login. @@ -31,7 +31,7 @@ #' If the AzureGraph package is installed and the `graph_host` argument is not `NULL`, `create_azure_login` will also create a login client for Microsoft Graph with the same credentials. This is to facilitate working with registered apps and service principals, eg when managing roles and permissions. Some Azure services also require creating service principals as part of creating a resource (eg Azure Kubernetes Service), and keeping the Graph credentials consistent with ARM helps ensure nothing breaks. #' #' @section Linux DSVM note: -#' If you are using a Linux [Data Science Virtual Machine](https://azure.microsoft.com/en-us/services/virtual-machines/data-science-virtual-machines/) in Azure, you may have problems running `create_azure_login()` (ie, without any arguments). In this case, try `create_azure_login(auth_type="device_code")`. +#' If you are using a Linux [Data Science Virtual Machine](https://azure.microsoft.com/en-us/products/virtual-machines/data-science-virtual-machines/) in Azure, you may have problems running `create_azure_login()` (ie, without any arguments). In this case, try `create_azure_login(auth_type="device_code")`. #' #' @return #' For `get_azure_login` and `create_azure_login`, an object of class `az_rm`, representing the ARM login client. For `list_azure_logins`, a (possibly nested) list of such objects. diff --git a/R/az_resgroup.R b/R/az_resgroup.R index de83085..bcc2865 100644 --- a/R/az_resgroup.R +++ b/R/az_resgroup.R @@ -33,7 +33,7 @@ #' @section Initialization: #' 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 create a resource group object in isolation, supply (at least) an Oauth 2.0 token of class [AzureAuth::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()`. #' #' @section Templates: #' To deploy a new template, pass the following arguments to `deploy_template()`: @@ -75,8 +75,7 @@ #' @seealso #' [az_subscription], [az_template], [az_resource], #' [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) +#' [Resources API reference](https://learn.microsoft.com/en-us/rest/api/resources/resources) #' #' For role-based access control methods, see [rbac] #' diff --git a/R/az_rm.R b/R/az_rm.R index 580584a..9294833 100644 --- a/R/az_rm.R +++ b/R/az_rm.R @@ -27,7 +27,7 @@ #' - `aad_host`: Azure Active Directory host for authentication. Defaults to `https://login.microsoftonline.com/`. Change this if you are using a government or private cloud. #' - `...`: Further arguments to pass to `get_azure_token`. #' - `scopes`: The Azure Service Management scopes (permissions) to obtain for this login. Only for `version=2`. -#' - `token`: Optionally, an OAuth 2.0 token, of class [AzureToken]. This allows you to reuse the authentication details for an existing session. If supplied, all other arguments will be ignored. +#' - `token`: Optionally, an OAuth 2.0 token, of class [AzureAuth::AzureToken]. This allows you to reuse the authentication details for an existing session. If supplied, all other arguments will be ignored. #' #' @section Operations: #' The `do_operation()` method allows you to carry out arbitrary operations on the Resource Manager endpoint. It takes the following arguments: diff --git a/R/az_subscription.R b/R/az_subscription.R index 419bde2..5ef3f76 100644 --- a/R/az_subscription.R +++ b/R/az_subscription.R @@ -29,7 +29,7 @@ #' - `get_tags()` Get the tags on this subscription. #' #' @section Details: -#' Generally, the easiest way to create a subscription object is via the `get_subscription` or `list_subscriptions` methods of the [az_rm] class. To create a subscription object in isolation, call the `new()` method and supply an Oauth 2.0 token of class [AzureToken], along with the ID of the subscription. +#' Generally, the easiest way to create a subscription object is via the `get_subscription` or `list_subscriptions` methods of the [az_rm] class. To create a subscription object in isolation, call the `new()` method and supply an Oauth 2.0 token of class [AzureAuth::AzureToken], along with the ID of the subscription. #' #' @section Operations: #' The `do_operation()` method allows you to carry out arbitrary operations on the subscription. It takes the following arguments: @@ -158,7 +158,7 @@ public=list( else sapply(apis, select_version) } }, - + get_tags=function() { if(is.null(self$tags)) diff --git a/R/az_template.R b/R/az_template.R index 9fc1023..5b0abd6 100644 --- a/R/az_template.R +++ b/R/az_template.R @@ -33,8 +33,7 @@ #' #' @seealso #' [az_resource_group], [az_resource], [build_template_definition], [build_template_parameters] -#' [Template overview](https://learn.microsoft.com/en-us/azure/templates/), -#' [Template API reference](https://learn.microsoft.com/en-us/rest/api/resources/deployments) +#' [Template overview](https://learn.microsoft.com/en-us/azure/templates/) #' #' @examples #' \dontrun{ diff --git a/R/call_azure_rm.R b/R/call_azure_rm.R index 32dd83e..0f01944 100644 --- a/R/call_azure_rm.R +++ b/R/call_azure_rm.R @@ -1,6 +1,6 @@ #' Call the Azure Resource Manager REST API #' -#' @param token An Azure OAuth token, of class [AzureToken]. +#' @param token An Azure OAuth token, of class [AzureAuth::AzureToken]. #' @param subscription For `call_azure_rm`, a subscription ID. #' @param operation The operation to perform, which will form part of the URL path. #' @param options A named list giving the URL query parameters. diff --git a/R/utils.R b/R/utils.R index 970a20c..3955bac 100644 --- a/R/utils.R +++ b/R/utils.R @@ -3,7 +3,7 @@ #' @param lst A named list of objects. #' @param x For `is_url`, An R object. #' @param https_only For `is_url`, whether to allow only HTTPS URLs. -#' @param token For `get_paged_list`, an Azure OAuth token, of class [AzureToken]. +#' @param token For `get_paged_list`, an Azure OAuth token, of class [AzureAuth::AzureToken]. #' @param next_link_name,value_name For `get_paged_list`, the names of the next link and value components in the `lst` argument. The default values are correct for Resource Manager. #' #' @details diff --git a/README.md b/README.md index 98cd9c4..47d9e9b 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ stor2$add_role_assignment("041ff2be-4eb0-11e9-8f38-394fbcd0b29d", "Storage blob ## Extending -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](https://github.com/Azure/AzureVM) for [virtual machines](https://azure.microsoft.com/en-us/services/virtual-machines/), and [AzureStor](https://github.com/Azure/AzureStor) for [storage accounts](https://azure.microsoft.com/en-us/product-categories/storage/). For more information, see the ["Extending AzureRMR" vignette](vignettes/extend.Rmd). +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](https://github.com/Azure/AzureVM) for [virtual machines](https://azure.microsoft.com/en-us/products/virtual-machines/), and [AzureStor](https://github.com/Azure/AzureStor) for [storage accounts](https://azure.microsoft.com/en-us/products/category/storage/). For more information, see the ["Extending AzureRMR" vignette](vignettes/extend.Rmd). ## Acknowledgements diff --git a/man/az_resource_group.Rd b/man/az_resource_group.Rd index 0476b11..2173df7 100644 --- a/man/az_resource_group.Rd +++ b/man/az_resource_group.Rd @@ -45,7 +45,7 @@ Class representing an Azure 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 \code{get_resource_group}, \code{create_resource_group} or \code{list_resource_groups} methods of the \link{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 \link{AzureToken}, the subscription ID, and the resource group name. If this object refers to a \emph{new} resource group, supply the location as well (use the \code{list_locations} method of the \verb{az_subscription class} for possible locations). You can also pass any optional parameters for the resource group as named arguments to \code{new()}. +To create a resource group object in isolation, supply (at least) an Oauth 2.0 token of class \link[AzureAuth:AzureToken]{AzureAuth::AzureToken}, the subscription ID, and the resource group name. If this object refers to a \emph{new} resource group, supply the location as well (use the \code{list_locations} method of the \verb{az_subscription class} for possible locations). You can also pass any optional parameters for the resource group as named arguments to \code{new()}. } \section{Templates}{ @@ -145,8 +145,7 @@ rg$delete() \seealso{ \link{az_subscription}, \link{az_template}, \link{az_resource}, \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} +\href{https://learn.microsoft.com/en-us/rest/api/resources/resources}{Resources API reference} For role-based access control methods, see \link{rbac} diff --git a/man/az_rm.Rd b/man/az_rm.Rd index a4d7e7f..db40362 100644 --- a/man/az_rm.Rd +++ b/man/az_rm.Rd @@ -38,7 +38,7 @@ To authenticate with the \code{az_rm} class directly, provide the following argu \item \code{aad_host}: Azure Active Directory host for authentication. Defaults to \verb{https://login.microsoftonline.com/}. Change this if you are using a government or private cloud. \item \code{...}: Further arguments to pass to \code{get_azure_token}. \item \code{scopes}: The Azure Service Management scopes (permissions) to obtain for this login. Only for \code{version=2}. -\item \code{token}: Optionally, an OAuth 2.0 token, of class \link{AzureToken}. This allows you to reuse the authentication details for an existing session. If supplied, all other arguments will be ignored. +\item \code{token}: Optionally, an OAuth 2.0 token, of class \link[AzureAuth:AzureToken]{AzureAuth::AzureToken}. This allows you to reuse the authentication details for an existing session. If supplied, all other arguments will be ignored. } } diff --git a/man/az_subscription.Rd b/man/az_subscription.Rd index 474b86b..4321758 100644 --- a/man/az_subscription.Rd +++ b/man/az_subscription.Rd @@ -39,7 +39,7 @@ Class representing an Azure subscription. \section{Details}{ -Generally, the easiest way to create a subscription object is via the \code{get_subscription} or \code{list_subscriptions} methods of the \link{az_rm} class. To create a subscription object in isolation, call the \code{new()} method and supply an Oauth 2.0 token of class \link{AzureToken}, along with the ID of the subscription. +Generally, the easiest way to create a subscription object is via the \code{get_subscription} or \code{list_subscriptions} methods of the \link{az_rm} class. To create a subscription object in isolation, call the \code{new()} method and supply an Oauth 2.0 token of class \link[AzureAuth:AzureToken]{AzureAuth::AzureToken}, along with the ID of the subscription. } \section{Operations}{ diff --git a/man/az_template.Rd b/man/az_template.Rd index 8f20cb8..76685b1 100644 --- a/man/az_template.Rd +++ b/man/az_template.Rd @@ -72,6 +72,5 @@ tpl$delete(free_resources=TRUE) } \seealso{ \link{az_resource_group}, \link{az_resource}, \link{build_template_definition}, \link{build_template_parameters} -\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} +\href{https://learn.microsoft.com/en-us/azure/templates/}{Template overview} } diff --git a/man/azure_login.Rd b/man/azure_login.Rd index 2473bf9..17d03c4 100644 --- a/man/azure_login.Rd +++ b/man/azure_login.Rd @@ -44,7 +44,7 @@ list_azure_logins() \item{config_file}{Optionally, a JSON file containing any of the arguments listed above. Arguments supplied in this file take priority over those supplied on the command line. You can also use the output from the Azure CLI \verb{az ad sp create-for-rbac} command.} -\item{token}{Optionally, an OAuth 2.0 token, of class \link{AzureToken}. This allows you to reuse the authentication details for an existing session. If supplied, the other arguments above to \code{create_azure_login} will be ignored.} +\item{token}{Optionally, an OAuth 2.0 token, of class \link[AzureAuth:AzureToken]{AzureAuth::AzureToken}. This allows you to reuse the authentication details for an existing session. If supplied, the other arguments above to \code{create_azure_login} will be ignored.} \item{graph_host}{The Microsoft Graph endpoint. See 'Microsoft Graph integration' below.} @@ -80,7 +80,7 @@ If the AzureGraph package is installed and the \code{graph_host} argument is not \section{Linux DSVM note}{ -If you are using a Linux \href{https://azure.microsoft.com/en-us/services/virtual-machines/data-science-virtual-machines/}{Data Science Virtual Machine} in Azure, you may have problems running \code{create_azure_login()} (ie, without any arguments). In this case, try \code{create_azure_login(auth_type="device_code")}. +If you are using a Linux \href{https://azure.microsoft.com/en-us/products/virtual-machines/data-science-virtual-machines/}{Data Science Virtual Machine} in Azure, you may have problems running \code{create_azure_login()} (ie, without any arguments). In this case, try \code{create_azure_login(auth_type="device_code")}. } \examples{ diff --git a/man/call_azure.Rd b/man/call_azure.Rd index b32ce1f..d77684d 100644 --- a/man/call_azure.Rd +++ b/man/call_azure.Rd @@ -14,7 +14,7 @@ call_azure_url(token, url, ..., body = NULL, encode = "json", auto_refresh = TRUE) } \arguments{ -\item{token}{An Azure OAuth token, of class \link{AzureToken}.} +\item{token}{An Azure OAuth token, of class \link[AzureAuth:AzureToken]{AzureAuth::AzureToken}.} \item{subscription}{For \code{call_azure_rm}, a subscription ID.} diff --git a/man/utils.Rd b/man/utils.Rd index 7c38a8d..47d1e32 100644 --- a/man/utils.Rd +++ b/man/utils.Rd @@ -17,7 +17,7 @@ get_paged_list(lst, token, next_link_name = "nextLink", \item{lst}{A named list of objects.} -\item{token}{For \code{get_paged_list}, an Azure OAuth token, of class \link{AzureToken}.} +\item{token}{For \code{get_paged_list}, an Azure OAuth token, of class \link[AzureAuth:AzureToken]{AzureAuth::AzureToken}.} \item{next_link_name, value_name}{For \code{get_paged_list}, the names of the next link and value components in the \code{lst} argument. The default values are correct for Resource Manager.} } diff --git a/vignettes/intro.Rmd b/vignettes/intro.Rmd index 5261ffc..11bb298 100644 --- a/vignettes/intro.Rmd +++ b/vignettes/intro.Rmd @@ -298,4 +298,4 @@ Technically role definitions and assignments are _resources_ and could be manipu ## Conclusion -This has been a quick introduction to the features of AzureRMR. Remember that this package is only 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](https://github.com/cloudyr/AzureVM) for [virtual machines](https://azure.microsoft.com/en-us/services/virtual-machines/), and [AzureStor](https://github.com/cloudyr/AzureStor) for [storage accounts](https://azure.microsoft.com/en-us/product-categories/storage/). For more information, see the "Extending AzureRMR" vignette. +This has been a quick introduction to the features of AzureRMR. Remember that this package is only 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](https://github.com/cloudyr/AzureVM) for [virtual machines](https://azure.microsoft.com/en-us/products/virtual-machines/), and [AzureStor](https://github.com/cloudyr/AzureStor) for [storage accounts](https://azure.microsoft.com/en-us/products/category/storage/). For more information, see the "Extending AzureRMR" vignette.