Skip to content

Commit 32f4eb7

Browse files
authored
Merge pull request #658 from The-Strategy-Unit/use_azkit
2 parents 6e2ffde + d33acd2 commit 32f4eb7

3 files changed

Lines changed: 11 additions & 19 deletions

File tree

DESCRIPTION

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Depends:
1919
R (>= 4.4.0)
2020
Imports:
2121
arrow,
22-
AzureAuth,
22+
azkit,
2323
AzureStor,
2424
bs4Dash,
2525
cachem,
@@ -69,7 +69,8 @@ Suggests:
6969
usethis,
7070
watchr (>= 0.0.0.9000)
7171
Remotes:
72-
github::tomjemmett/watchr
72+
github::tomjemmett/watchr,
73+
github::the-strategy-unit/azkit
7374
Config/testthat/edition: 3
7475
Encoding: UTF-8
7576
Language: en-GB

R/fct_azure_storage.R

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,14 @@ load_provider_data <- function(
2121

2222
#' Get ADLS Filesystem
2323
#'
24-
#' try to use a managed token, this will only work if run in an Azure data centre
25-
#' if it fails, try instead to use Azure Resource Manager
24+
#' Get the Azure Data Lake Storage filesystem using the endpoint and container
25+
#' specified in environment variables. (AZ_STORAGE_EP and AZ_STORAGE_CONTAINER)
2626
#'
2727
#' @return the adls filesystem
2828
get_adls_fs <- function() {
29-
ep_uri <- Sys.getenv("LOCAL_STORAGE_EP")
29+
token <- azkit::get_auth_token()
3030

31-
ep <- if (ep_uri != "") {
32-
sa_key <- Sys.getenv("LOCAL_STORAGE_KEY")
33-
34-
AzureStor::adls_endpoint(ep_uri, key = sa_key)
35-
} else {
36-
ep_uri <- Sys.getenv("AZ_STORAGE_EP")
37-
token <- AzureAuth::get_managed_token("https://storage.azure.com/") |>
38-
AzureAuth::extract_jwt()
39-
40-
AzureStor::adls_endpoint(ep_uri, token = token)
41-
}
42-
AzureStor::adls_filesystem(ep, Sys.getenv("AZ_STORAGE_CONTAINER"))
31+
Sys.getenv("AZ_STORAGE_EP") |>
32+
AzureStor::adls_endpoint(token = token) |>
33+
AzureStor::adls_filesystem(Sys.getenv("AZ_STORAGE_CONTAINER"))
4334
}

man/get_adls_fs.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)