Skip to contents

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)
#> [1] TRUE

if (FALSE) { # \dontrun{
# Requires Azure CLI installed and signed in to the intended Azure tenant.
token <- provider()
} # }