I have a problem with using AzureStor API in RStudio.
First I login in Azure with:
az <- AzureRMR::create_azure_login()
I see a message in my browser that it was successful :
Authenticated with Azure Active Directory. Please close this page and return to R.
After it I'm trying to upload a file to storage:
storage_account <- storage_endpoint("https://accountname.blob.core.windows.net", az)
container <- storage_container(storage_account, "container")
storage_upload(container, src = file_path, dest = folder_path)
After this I see this error:
Warning: Error in openssl::base64_decode: check failed: (is.character(text))
I also see the same error while using list_storage_files
, so I guess it's not storage_upload
specific, and probably related to authentification somehow, but I'm not sure how to fix it.
Any help would be appreciated, thanks
Looking at the documentation here
, I believe you are getting this error because storage_endpoint
method is expecting the 2nd argument as a base64 encoded string (which is account key) and you are passing something different.
Considering you are using Azure AD Auth, I believe you would need to acquire a token for the storage resource and pass that token to this method.
Not very familiar with R and this package, but I think your code would be something like this:
token <- AzureRMR::get_azure_token(resource="https://storage.azure.com", tenant="your-tenant-id", app="your-app-id")
storage_account <- storage_endpoint("https://accountname.blob.core.windows.net", token=token)
...rest of your code