Set a Microsoft Entra ID bearer token for keyless authentication. API keys remain supported, but Microsoft recommends keyless authentication for production workloads.
Usage
foundry_set_token(token, store = FALSE, scope = c("resource", "project"))Arguments
- token
Character string containing a bearer token. Do not include the
"Bearer "prefix.- store
Logical. If
TRUE, stores the token in foundryR's package-specific user configuration file. Tokens expire, so persistent tokens are usually only useful for local testing.- scope
Character. Endpoint family for the token:
"resource"for resource-level/openai/v1and supported Content Safety operations, or"project"for/api/projects/...operations.
Examples
withr::with_envvar(c(AZURE_FOUNDRY_TOKEN = NA_character_), {
foundry_set_token("eyJ0eXAiOiJKV1QiLCJhbGciOi...")
})
#> ✔ resource bearer token set for current session.