次のような場合に使用: Auth0 CLI(コマンドラインツール)を使ってテナント(独立した専用環境)のリソースを管理する際。アプリやAPI の作成、ユーザー・ロール・組織・アクション・ログストリーム・カスタムドメイン・ユニバーサルログイン設定の管理が該当します。また、CLI から Auth0 管理API を直接呼び出す場合にも使用します。
Use when running Auth0 CLI commands to manage tenant resources — creating apps or APIs, managing users, roles, organizations, actions, log streams, custom domains, or Universal Login config. Also use when calling the Auth0 Management API directly via the CLI.
Auth0 CLI(auth0)を使用すると、ターミナルからテナントを管理できます。
Homebrew でインストールできます(brew install auth0/auth0-cli/auth0)。
フラグの完全な定義とサンプルについては、CLI フルリファレンスを参照してください。
auth0 login # インタラクティブなデバイスコードログイン
auth0 login --scopes "read:client_grants" # 403 エラー時に追加スコープをリクエスト
auth0 login --domain <tenant>.auth0.com --client-id <id> --client-secret "$AUTH0_CLIENT_SECRET" # CI/CD 用
JWT を使ったマシンログイン、テナント管理、ログアウトについては、認証の詳細を参照してください。
| やりたいこと | 使用するコマンド |
|---|---|
| 新規プロジェクトのセットアップ | auth0 apps create --type spa|regular|m2m|native --json |
| クライアント ID またはシークレットの取得 | auth0 apps show <id> -r --json |
| バックエンド API の登録 | auth0 apis create --identifier "https://..." --json |
| ユーザー ID の検索 | auth0 users search --query "email:..." --json |
| ロールの作成・管理(RBAC) | auth0 roles create / auth0 users roles assign |
| B2B マルチテナンシー | auth0 orgs create |
| カスタムログインロジック | auth0 actions create --trigger post-login --json |
| ログインページのブランディング | auth0 ul update --logo ... --accent ... |
| ログイン用カスタムドメイン | auth0 domains create --domain "auth.myapp.com" --json |
| ログイン失敗のデバッグ | auth0 logs tail --filter "type:f" --json-compact |
| ログインフローのテスト | auth0 test login <client-id> |
| 設定を Terraform 形式でエクスポート | auth0 terraform generate --output-dir ./terraform |
| コネクション・グラント・フックの管理 | auth0 api get <path> |
| スクリプティング / 出力のパース | 任意のコマンドに --json または --json-compact を追加 |
| セキュリティ強化 | auth0 protection brute-force-protection update --enabled true |
| ログの外部ルーティング | auth0 logs streams create datadog|http|splunk |
| ユーザーの一括インポート | auth0 users import --connection-name ... --users '...' --json |
Auth0 アプリケーション(クライアント ID、シークレット、コールバック URL、アプリタイプ)を作成・確認します。
エイリアス: auth0 clients
auth0 apps create --name "My SPA" --type spa \
--auth-method None \
--callbacks "http://localhost:3000" \
--logout-urls "http://localhost:3000" \
--origins "http://localhost:3000" --json
auth0 apps list --json-compact
auth0 apps show <client-id> --json
auth0 apps update <client-id> --callbacks "http://localhost:3000,https://myapp.com" --json
auth0 apps delete <client-id> --force
アプリタイプ: spa、regular、m2m、native、resource_server
詳細: Apps リファレンス
Auth0 トークンで保護するバックエンド API(リソースサーバー)を登録します。
エイリアス: auth0 resource-servers
auth0 apis create --name "My API" --identifier "https://api.myapp.com" \
--scopes "read:data,write:data" --token-lifetime 3600 --json
auth0 apis list --json-compact
auth0 apis scopes list <api-id> --json
重要な区別: apps = トークンをリクエストするクライアント。apis = トークンを受け取るリソース。
詳細: APIs リファレンス
テナント内のユーザーを作成・検索・確認・インポート・管理します。
auth0 users search --query "email:user@example.com" --json
auth0 users search-by-email user@example.com --json-compact
auth0 users create --connection-name "Username-Password-Authentication" \
--email "test@example.com" --password "$USER_PASSWORD" --json
auth0 users show <user-id> --json
auth0 users blocks list <email> --json
auth0 users blocks unblock <email>
auth0 users import --connection-name "Username-Password-Authentication" \
--users '[...]' --upsert --json
詳細: Users リファレンス
ロールの作成、パーミッションの割り当て、ユーザーへのロール付与を行います。 CLI はすべてのロール操作に専用コマンドを提供しています。
auth0 roles create --name "editor" --description "Can edit content" --json
auth0 roles permissions add <role-id> --api-id <api-id> --permissions "read:data,write:data" --json
auth0 users roles assign <user-id> --roles <role-id>
auth0 users roles show <user-id> --json-compact
詳細: Roles リファレンス
B2B SaaS シナリオ向けに Organization を管理します。
エイリアス: auth0 orgs
auth0 orgs create --name "acme-corp" --display "Acme Corporation" \
--logo "https://acme.com/logo.png" --accent "#FF6600" --json
auth0 orgs members list <org-id> --json
auth0 orgs invitations create --org-id <org-id> --invitee-email "new@acme.com" \
--inviter-name "Admin" --client-id <id> --json
認証パイプラインのトリガーポイントでサーバーレス関数を作成・デプロイします。 非推奨となった Rules の代替機能です。
auth0 actions create --name "Add Claims" --trigger "post-login" \
--code 'exports.onExecutePostLogin = async (event, api) => { ... }' --json
auth0 actions deploy <action-id>
トリガー: post-login、credentials-exchange、pre-user-registration、post-user-registration、post-change-password、send-phone-message
重要: 作成または更新後は必ず deploy を実行しないと変更が反映されません。
詳細: Actions リファレンス
auth0 logs tail --filter "type:f" --json-compact # リアルタイムのログイン失敗
auth0 logs list --filter "type:f" --number 20 --json-compact # 過去のログ
主なコード: s(成功)、f(ログイン失敗)、slo(ログアウト)、fs(サイレント認証失敗)
詳細: Logs リファレンス
auth0 domains create --domain "auth.myapp.com" --type "auth0_managed_certs" --json
auth0 domains verify <domain-id> --json
詳細: Domains リファレンス
auth0 ul update --accent "#FF6600" --background "#FFFFFF" \
--logo "https://myapp.com/logo.png" --json
auth0 terraform generate --output-dir ./terraform --resources "auth0_client,auth0_connection"
詳細: Terraform リファレンス
auth0 test login <client-id>
auth0 test login <client-id> --audience "https://api.myapp.com" --scopes "openid profile email"
詳細: Test リファレンス
auth0 protection brute-force-protection update --enabled true
auth0 protection breached-password-detection update --enabled true
auth0 protection bot-detection update --enabled true
auth0 logs streams create datadog # インタラクティブセットアップ
auth0 logs streams create http # カスタム Webhook
auth0 logs streams list --json
対応サービス: eventbridge、eventgrid、http、datadog、splunk、sumo
専用コマンドが存在しない場合、auth0 api で Management API v2 のエンドポイントを直接呼び出せます。
auth0 api get connections
auth0 api post client-grants --data '{"client_id":"...","audience":"...","scope":["read:data"]}'
auth0 api get stats/daily -q "from=20240101" -q "to=20240131"
詳細: Raw API リファレンス
機械可読な出力には常に --json または --json-compact を使用してください。
以下の 3 つのモードは互いに排他的です。
| フラグ | 次のような場合に使用 |
|---|---|
--json |
目視確認・デバッグ — インデント付きの整形出力 |
--json-compact |
jq へのパイプ・スクリプティング・パイプライン — コンパクトな 1 行出力 |
--csv |
スプレッドシートや表形式のエクスポート |
auth0 apps list --json-compact | jq '.[] | {client_id, name}'
auth0 users show <user-id> --json-compact | jq '{id: .user_id, email: .email}'
auth0 roles list --json-compact | jq '.[].name'
詳細: 出力フォーマットリファレンス
すべてのフラグ・サンプル・使用パターンを含む CLI 完全リファレンス:
auth0-quickstart — Auth0 初期セットアップ、フレームワーク検出auth0-migration — 他の認証プロバイダーからの移行auth0-mfa — 多要素認証(MFA)セットアップThe Auth0 CLI (auth0) lets you manage your tenant from the terminal. Install it via Homebrew (brew install auth0/auth0-cli/auth0). For complete flag definitions and examples, see the Full CLI Reference.
auth0 login # interactive device-code login
auth0 login --scopes "read:client_grants" # request extra scopes if 403
auth0 login --domain <tenant>.auth0.com --client-id <id> --client-secret "$AUTH0_CLIENT_SECRET" # CI/CD
See Authentication Details for machine login with JWT, tenant management, and logout.
| What you're doing | Command to use |
|---|---|
| Setting up a new project | auth0 apps create --type spa|regular|m2m|native --json |
| Need a client ID or secret | auth0 apps show <id> -r --json |
| Registering a backend API | auth0 apis create --identifier "https://..." --json |
| Finding a user's ID | auth0 users search --query "email:..." --json |
| Creating/managing roles (RBAC) | auth0 roles create / auth0 users roles assign |
| B2B multi-tenancy | auth0 orgs create |
| Custom login logic | auth0 actions create --trigger post-login --json |
| Branding the login page | auth0 ul update --logo ... --accent ... |
| Custom domain for login | auth0 domains create --domain "auth.myapp.com" --json |
| Debugging a failed login | auth0 logs tail --filter "type:f" --json-compact |
| Testing a login flow | auth0 test login <client-id> |
| Exporting config as Terraform | auth0 terraform generate --output-dir ./terraform |
| Managing connections, grants, hooks | auth0 api get <path> |
| Scripting / parsing output | Add --json or --json-compact to any command |
| Security hardening | auth0 protection brute-force-protection update --enabled true |
| Routing logs externally | auth0 logs streams create datadog|http|splunk |
| Bulk importing users | auth0 users import --connection-name ... --users '...' --json |
Create or inspect Auth0 applications (client ID, secret, callback URLs, app type). Alias: auth0 clients.
auth0 apps create --name "My SPA" --type spa \
--auth-method None \
--callbacks "http://localhost:3000" \
--logout-urls "http://localhost:3000" \
--origins "http://localhost:3000" --json
auth0 apps list --json-compact
auth0 apps show <client-id> --json
auth0 apps update <client-id> --callbacks "http://localhost:3000,https://myapp.com" --json
auth0 apps delete <client-id> --force
App types: spa, regular, m2m, native, resource_server
Full details: Apps Reference
Register backend APIs (Resource Servers) to protect with Auth0 tokens. Alias: auth0 resource-servers.
auth0 apis create --name "My API" --identifier "https://api.myapp.com" \
--scopes "read:data,write:data" --token-lifetime 3600 --json
auth0 apis list --json-compact
auth0 apis scopes list <api-id> --json
Key distinction: apps = the client requesting tokens. apis = the resource accepting tokens.
Full details: APIs Reference
Create, search, inspect, import, and manage users in your tenant.
auth0 users search --query "email:user@example.com" --json
auth0 users search-by-email user@example.com --json-compact
auth0 users create --connection-name "Username-Password-Authentication" \
--email "test@example.com" --password "$USER_PASSWORD" --json
auth0 users show <user-id> --json
auth0 users blocks list <email> --json
auth0 users blocks unblock <email>
auth0 users import --connection-name "Username-Password-Authentication" \
--users '[...]' --upsert --json
Full details: Users Reference
Create roles, assign permissions, and assign roles to users. The CLI has dedicated commands for all role operations.
auth0 roles create --name "editor" --description "Can edit content" --json
auth0 roles permissions add <role-id> --api-id <api-id> --permissions "read:data,write:data" --json
auth0 users roles assign <user-id> --roles <role-id>
auth0 users roles show <user-id> --json-compact
Full details: Roles Reference
Manage organizations for B2B SaaS scenarios. Alias: auth0 orgs.
auth0 orgs create --name "acme-corp" --display "Acme Corporation" \
--logo "https://acme.com/logo.png" --accent "#FF6600" --json
auth0 orgs members list <org-id> --json
auth0 orgs invitations create --org-id <org-id> --invitee-email "new@acme.com" \
--inviter-name "Admin" --client-id <id> --json
Full details: Organizations Reference
Create and deploy serverless functions at auth pipeline trigger points. Replaces deprecated Rules.
auth0 actions create --name "Add Claims" --trigger "post-login" \
--code 'exports.onExecutePostLogin = async (event, api) => { ... }' --json
auth0 actions deploy <action-id>
Triggers: post-login, credentials-exchange, pre-user-registration, post-user-registration, post-change-password, send-phone-message
Important: You must deploy after creating or updating for changes to take effect.
Full details: Actions Reference
auth0 logs tail --filter "type:f" --json-compact # real-time failed logins
auth0 logs list --filter "type:f" --number 20 --json-compact # historical
Common codes: s (success), f (failed login), slo (logout), fs (silent auth failure)
Full details: Logs Reference
auth0 domains create --domain "auth.myapp.com" --type "auth0_managed_certs" --json
auth0 domains verify <domain-id> --json
Full details: Domains Reference
auth0 ul update --accent "#FF6600" --background "#FFFFFF" \
--logo "https://myapp.com/logo.png" --json
Full details: Universal Login Reference
auth0 terraform generate --output-dir ./terraform --resources "auth0_client,auth0_connection"
Full details: Terraform Reference
auth0 test login <client-id>
auth0 test login <client-id> --audience "https://api.myapp.com" --scopes "openid profile email"
Full details: Test Reference
auth0 protection brute-force-protection update --enabled true
auth0 protection breached-password-detection update --enabled true
auth0 protection bot-detection update --enabled true
Full details: Attack Protection Reference
auth0 logs streams create datadog # interactive setup
auth0 logs streams create http # custom webhook
auth0 logs streams list --json
Supported: eventbridge, eventgrid, http, datadog, splunk, sumo
Full details: Log Streams Reference
When a dedicated command doesn't exist, auth0 api calls Management API v2 endpoints directly.
auth0 api get connections
auth0 api post client-grants --data '{"client_id":"...","audience":"...","scope":["read:data"]}'
auth0 api get stats/daily -q "from=20240101" -q "to=20240131"
Full details: Raw API Reference
Always use --json or --json-compact for machine-readable output. Three modes (mutually exclusive):
| Flag | When to use |
|---|---|
--json |
Human inspection, debugging — pretty-printed with indentation |
--json-compact |
Piping to jq, scripting, pipelines — compact single-line |
--csv |
Spreadsheets and tabular export |
auth0 apps list --json-compact | jq '.[] | {client_id, name}'
auth0 users show <user-id> --json-compact | jq '{id: .user_id, email: .email}'
auth0 roles list --json-compact | jq '.[].name'
Full details: Output Formatting Reference
Complete CLI reference with all flags, examples, and usage patterns:
auth0-quickstart — Initial Auth0 setup, framework detectionauth0-migration — Migrate from other auth providersauth0-mfa — Multi-Factor Authentication setup原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。