[BUG] Regression - Azure Foundry auth failing since 2.0.70

Status Open
Maintainer reply ✓ Yes — ant-kurt
Activity 5 comments · opened Dec 17, 2025
💡 Likely answer: A maintainer (ant-kurt, collaborator) responded on this thread — see the highlighted reply below.

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

The latest version of claude code fails to authenticate with Azure foundry it works in 2.0.62

What Should Happen?

claude should work

Error Messages/Logs

Invalid API key · Please run /login

Steps to Reproduce

  1. Update to latest version 2.0.72
  2. export keys for connecting to foundry
  3. observe errors when trying to connect to claude
  4. revert to 2.0.62
  5. everything works fine

Claude Model

Sonnet (default)

Is this a regression?

Yes, this worked in a previous version

Last Working Version

2.0.62

Claude Code Version

N/A

Platform

Other

Operating System

Ubuntu/Debian Linux

Terminal/Shell

VS Code integrated terminal

Additional Information

_No response_

View original on GitHub ↗

5 Comments

ant-kurt collaborator · 8 months ago

What are the names of the environment variables you're setting for Foundry? When you submit a prompt, what error do you get?

JC-wk · 8 months ago

Hi @ant-kurt I have the following set

# Claude Code + Azure AI Foundry configuration
CLAUDE_CODE_USE_FOUNDRY=1

# Your Foundry resource base URL
ANTHROPIC_FOUNDRY_RESOURCE=<redacted>

# API key from your Foundry deployment
ANTHROPIC_FOUNDRY_API_KEY=<redacted>

# Optional: default models for Claude Code
ANTHROPIC_DEFAULT_HAIKU_MODEL=claude-haiku-4-5
ANTHROPIC_DEFAULT_SONNET_MODEL=claude-sonnet-4-5
ANTHROPIC_DEFAULT_OPUS_MODEL=claude-opus-4-5
ANTHROPIC_MODEL=claude-haiku-4-5

<img width="561" height="188" alt="Image" src="https://github.com/user-attachments/assets/fe935e2b-1883-4d79-a93d-c4782e80b177" />

When I downgrade:

<img width="561" height="295" alt="Image" src="https://github.com/user-attachments/assets/34996945-0a14-432f-9cd0-f8c87e16dbbb" />

moolen · 7 months ago

Can confirm, it's broken on the latest claude-code. reverting back to 2.0.64 fixed it for me.

env vars set:

ANTHROPIC_FOUNDRY_RESOURCE
ANTHROPIC_FOUNDRY_API_KEY
CLAUDE_CODE_USE_FOUNDRY=1

Error i'm seeing when trying to send a message:

⎿  500 {"error":{"code":"invalid_model_endpoint_authentication","message":"Failed to authenticate to backend endpoint. RequestId = ...","details":"Failed to authenticate to backend endpoint. RequestId = ..."}}

(it's not a auth issue, this works with the 2.0.64 version)

ant-kurt collaborator · 7 months ago

I'm having trouble reproducing this one - I'm able to use Claude Code with Foundry on the VS Code extension, using the below configuration.

.claude/settings.json

{
  "env": {
    "CLAUDE_CODE_USE_FOUNDRY": "1",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "my-model-1",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "my-model-2",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "my-model-3",
    "ANTHROPIC_FOUNDRY_BASE_URL": "redacted",
    "ANTHROPIC_FOUNDRY_API_KEY": "redacted"
  }
}

VS Code user settings

{
      "claudeCode.disableLoginPrompt": true
}

Can you try moving your env var configuration to settings.json and see if that helps?

JC-wk · 7 months ago

Hi @ant-kurt I've just tested that and can confirm that it's working with .claude/settings.json but not with env vars unless I downgrade. The docs specifically mention the env vars not the settings.json also https://code.claude.com/docs/en/microsoft-foundry