OpenAICloudflare Developer PlatformJul 2, 2026, 12:00 AM

Workers - Work across multiple accounts with Wrangler auth profiles

A condensed section focused on the key takeaways first.

Original Post

Quick Digest

Summary

A condensed section focused on the key takeaways first.

openaienmodel: gpt-5-mini-2025-08-07

Workers - Work across multiple accounts with Wrangler auth profiles

Key Points

  • Named auth profiles bound to directories
  • Automatic account switching by directory
  • CLOUDFLARE_API_TOKEN overrides profiles in CI

Summary

Wrangler CLI now supports named auth profiles: OAuth logins bound to directories so the CLI automatically chooses the right Cloudflare account based on the directory you’re working in. Profiles let you keep separate logins for different clients or separate staging/production accounts and reduce accidental cross-account operations when paired with an account_id in your Wrangler config.

Key Points

  • Create and activate a profile for each account: wrangler auth create <name> then wrangler auth activate <name> <path> to bind it to a directory (applies to that directory and its subdirectories).
  • Pair a profile with account_id in your wrangler.toml to prevent commands from reaching the wrong account.
  • Override directory selection for a single command with --profile, e.g. wrangler deploy --profile personal.
  • In CI/automation, CLOUDFLARE_API_TOKEN still takes precedence over profiles; use tokens for non-interactive environments.
  • See the Authentication profiles docs for setup details and the full resolution order.

Full Translation

Translations

A translation section that keeps the flow of the original article.

openaijamodel: gpt-5-mini-2025-08-07

Workers - Wrangler の認証プロファイルで複数アカウントをまたいで作業する

Wrangler の認証プロファイルで複数アカウントをまたいで作業する

Workers の Wrangler CLI は認証プロファイル (auth profiles) をサポートするようになりました。認証プロファイルは、特定の Cloudflare アカウントに紐づけた名前付きログインで、作業しているディレクトリに基づいて自動的に切り替わります。

  • プロファイルはディレクトリに結び付けられた名前付きの OAuth ログインです。
  • そのディレクトリおよびサブディレクトリで実行されるコマンドは、対応するアカウントを使用します。つまり、wrangler login を再実行せずにアカウント間を移動できます。
  • エージェンシーでクライアントごとにログインを分けたり、ステージングと本番で別アカウントを使い分けたりする用途に便利です。
  • Wrangler の設定ファイルに account_id をプロファイルに紐づけることで、コマンドが誤ったアカウントに到達するのを防げます。

使い方(例)

各アカウント用にプロファイルを作成し、どのディレクトリでそのプロファイルが有効になるかを指定します。例えば:

wrangler auth create client-a
wrangler auth activate client-a ~/clients/client-a
wrangler auth create client-b
wrangler auth activate client-b ~/clients/client-b

単一コマンドで明示的にプロファイルを指定するには、--profile フラグを使います:

wrangler deploy --profile personal

CI やその他の自動化環境では、環境変数 CLOUDFLARE_API_TOKEN がすべてのプロファイルに優先して使用されます。

セットアップ手順、解決順(resolution order)、およびコマンドの完全なリファレンスについては、Authentication profiles のドキュメントを参照してください。

Workers - Work across multiple accounts with Wrangler auth profiles | Cloudflare Developer Platform | DocsDigest