foundry_token_azure_cli: Create an Azure CLI token provider

View source: R/auth.R

foundry_token_azure_cliR Documentation

Create an Azure CLI token provider

Description

Create a provider function for foundry_set_token_provider() that shells out to ⁠az account get-access-token⁠. Tokens are cached until five minutes before expiry.

Usage

foundry_token_azure_cli(
  resource = "https://cognitiveservices.azure.com",
  az = "az"
)

Arguments

resource

Character. Azure resource used for the access token. Defaults to "https://cognitiveservices.azure.com" for resource-level v1 and Content Safety APIs. Use "https://ai.azure.com" for project APIs and register that provider with scope = "project".

az

Character. Azure CLI executable name or path.

Value

A zero-argument token provider function.

Examples

provider <- foundry_token_azure_cli()
is.function(provider)

## Not run: 
# Requires Azure CLI installed and signed in to the intended Azure tenant.
token <- provider()

## End(Not run)

foundryR documentation built on Sept. 25, 2026, 1:10 a.m.