How to replicate DefaultAzureCredential from azure.identity in R


I have been tasked to get an Azure token for a project in R. The python team shared how they approach it:

from azure.identity import DefaultAzureCredential

credential = DefaultAzureCredential()

token = credential.get_token("")

They said they only need to use the environment variable AZURE_TENANT_ID.

Generally, I use the {AzureAuth} package for handling this, but the get_azure_token() function requires more parameters that the python team did not need to specify with environment variables. The only information about finding an R alternative is in this GitHub issue that asks this question, but there is no clear answer to if a similar approach is available with {AzureAuth}. The original author stopped responding and the package owner advised not to open an issue for this topic and to use SO/Posit Community.

Appreciate any insight on this topic!