環境変数
ANTHROPIC_PROFILE
Claude Codeが起動時に読み取る認証プロファイルを指定しますが、v2.1.223以降ではセッション開始後の変更には対応していません。
使い方・用途
- 起動時のみ評価されるため、実行中に値を変更してもセッションの認証元は切り替わりません
- v2.1.223以降で設定を動的に反映させたい場合は、MDMやmanaged-settings.jsonといったエンドポイント管理設定を使用する必要があります
- サーバーからの動的な値の配信はセッションのセキュリティ保護を目的として制限されています
英語原文(公式ドキュメントより)
Claude Code reads the Workload Identity Federation variables and the ANTHROPIC_PROFILE and ANTHROPIC_CONFIG_DIR selectors only at startup, so a server-delivered value for them doesn't switch the session's credential source even after the fetch succeeds. To deliver those selectors on Claude Code v2.1.223 or later, use endpoint-managed settings such as MDM or managed-settings.json. For CLAUDE_CONFIG_DIR and the operating-system directory variables, the withholding itself is the protection: the cached value stays out of the environment until the server confirms the payload.