foundry_set_token: Set Azure AI Foundry Bearer Token

View source: R/auth.R

foundry_set_tokenR Documentation

Set Azure AI Foundry Bearer Token

Description

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/v1⁠ and supported Content Safety operations, or "project" for ⁠/api/projects/...⁠ operations.

Value

Invisibly returns TRUE if the token was set successfully.

Examples


withr::with_envvar(c(AZURE_FOUNDRY_TOKEN = NA_character_), {
foundry_set_token("eyJ0eXAiOiJKV1QiLCJhbGciOi...")
})


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