Skip to content
BENIBIX Learn

ANTHROPIC_FOUNDRY_API_KEY

AI⌨️ Claude CodeConfiguration

Also known as ANTHROPIC_FOUNDRY_AUTH_TOKEN

It gives Claude Code a key to sign in to Microsoft Foundry.

Think of it like

It is like the key to your shop, or a pass from the head office.

Example

Jack's CI cannot use his own Azure sign-in. He stores a Foundry key as a secret and sets it here, and the job signs in by itself.

Why it matters

Scripts and CI need a sign-in that does not depend on a person being logged in.

Definition

ANTHROPIC_FOUNDRY_API_KEY gives Claude Code a key to sign in to Foundry. Its twin with AUTH_TOKEN in the name takes a token, such as one from Entra. The token wins over the key. With neither, Claude Code uses the Azure sign-in on the machine. The token needs version 2.1.203 or later.

Example code

bash
export CLAUDE_CODE_USE_FOUNDRY=1
export ANTHROPIC_FOUNDRY_RESOURCE=my-resource
export ANTHROPIC_FOUNDRY_API_KEY=your-foundry-key
claude
Sign in to Foundry with a key.

Common mistake

Setting both and expecting the key to be used. The token wins when both are set.

Key takeaways

  1. 1
    Key. A Foundry API key.
  2. 2
    Token wins. Entra bearer token.
  3. 3
    Neither. Azure sign-in.