Skip to content

非公式 / UnofficialCloudflare, Inc. 非提携。アカウント情報は入力しないでください。Not affiliated with Cloudflare, Inc. Do not enter Cloudflare credentials here.Official docsこのサイトについてプライバシー

Windows ログイン前に Cloudflare One Client を接続する

最終更新 Markdown で表示Agent セットアップ

機能の提供状況

クライアントモード Zero Trust プラン ↗
  • Traffic and DNS mode
  • DNS only mode
  • Traffic only mode
  • Local proxy mode
すべてのプラン
システム 提供状況 必要な WARP の最小バージョン
Windows ✅ 2025.6.1400.0
macOS ❌
Linux ❌
iOS ❌
Android ❌
ChromeOS ❌

Cloudflare Zero Trust では、オンプレミスの Active Directory(または同等のサーバー)で、リモートユーザーの Windows ログイン資格情報を検証できます。ユーザーが初めて Windows ログイン情報を入力する前に、Cloudflare One Client(旧 WARP)はサービストークンを使って接続を確立します。この最初の接続はユーザー ID には紐づきません。ユーザーが Windows ログインを完了すると、Cloudflare One Client は ID ベースのセッションに切り替わり、以降のすべてのログインにそのユーザー登録を適用します。

前提条件

1. サービストークンを作成する

  1. Cloudflare ダッシュボード ↗ で Zero Trust > Access controls > Service credentials > Service Tokens を開きます。

  2. Create Service Token を選択します。

  3. サービストークンに名前を付けます。名前があると、ログ内の関連イベントを識別しやすく、トークンを個別に取り消せます。

  4. Service Token Duration を選びます。トークンの有効期限が決まります。

  5. Generate token を選択します。サービストークンの Client ID と Client Secret、およびそれぞれのリクエストヘッダーが表示されます。

  6. Client Secret をコピーします。

  1. Access Service Tokens エンドポイントに POST リクエストを送ります。

    Required API token permissions

    At least one of the following token permissions is required:
    • Access: Service Tokens Write
    Create a service tokenbash
    curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/access/service_tokens" \
    	--request POST \
    	--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
    	--json '{
    		"name": "CI/CD token",
    		"duration": "8760h"
    	}'
  2. レスポンスの client_id と client_secret の値をコピーします。

    レスポンスjson
    "result": {
    	"client_id": "88bf3b6d86161464f6509f7219099e57.access",
    	"client_secret": "bdd31cbc4dec990953e39163fbbb194c93313ca9f0a6e420346af9d326b1d2a5",
    	"created_at": "2025-09-25T22:26:26Z",
    	"expires_at": "2026-09-25T22:26:26Z",
    	"id": "3537a672-e4d8-4d89-aab9-26cb622918a1",
    	"name": "CI/CD token",
    	"updated_at": "2025-09-25T22:26:26Z",
    	"duration": "8760h",
    	"client_secret_version": 1
    }
  1. cloudflare_api_token ↗ に次の権限を追加します。

    • Access: Service Tokens Write
  2. cloudflare_zero_trust_access_service_token ↗ リソースを設定します。

    resource "cloudflare_zero_trust_access_service_token" "example_service_token" {
    	account_id = var.cloudflare_account_id
    	name       = "Example service token"
    	duration  = "8760h"
    
    	lifecycle {
    		create_before_destroy = true
    	}
    }
  3. サービストークンの Client ID と Client Secret を取得します。

    例: CLI に出力する

    1. Client ID と Client Secret を Terraform の state ファイルに出力します。
      output "example_service_token_client_id" {
      	value     = cloudflare_zero_trust_access_service_token.example_service_token.client_id
      }
      
      output "example_service_token_client_secret" {
      	value     = cloudflare_zero_trust_access_service_token.example_service_token.client_secret
      	sensitive = true
      }
    2. 構成を適用します。
      terraform apply
    3. Client ID と Client Secret を読み取ります。
      terraform output -raw example_service_token_client_id
      terraform output -raw example_service_token_client_secret

    例: HashiCorp Vault に保存する

    	resource "vault_generic_secret" "example_service_token" {
    		path         = "kv/cloudflare/example_service_token"
    
    		data_json = jsonencode({
    			"CLIENT_ID"     = cloudflare_access_service_token.example_service_token.client_id
    			"CLIENT_SECRET" = cloudflare_access_service_token.example_service_token.client_secret
    		})
    	}

2. デバイス登録ポリシーを作成する

デバイス登録の権限 で、次のポリシーを作成します。

Rule Action Rule type Selector Value
Service Auth Include Service Token <TOKEN-NAME>

2. (任意)プレログイン中のアクセスを制限する

サービストークンで登録されたデバイスは、メールアドレス non_identity@<team-name>.cloudflareaccess.com で識別されます。このメールアドレスを使い、プレログイン状態では特定の デバイスプロファイル設定 と Gateway ネットワークポリシー を適用できます。たとえば、Windows ログインやデバイス管理に必要なリソースだけにアクセスを限定できます。

デバイスプロファイルルールの例

Selector Operator Value Logic
User email in non_identity@<team-name>.cloudflareaccess.com And
Operating system is Windows

Gateway ネットワークポリシーの例

Selector Operator Value Logic
Destination IP in list Active Directory servers And
User email in non_identity@<team-name>.cloudflareaccess.com And
Passed Device Posture Checks in Windows 10 or higher (OS version)
Action
Allow

3. MDM ファイルを設定する

Windows のプレログイン機能を有効にするには、次の形式の MDM ファイルをデバイスへ デプロイ する必要があります。次の例では、pre_login キーがサービストークンでの接続を許可し、configs にデフォルトの Zero Trust 設定を入れます。

<dict>
  <key>pre_login</key>
  <dict>
    <key>organization</key>
    <string>mycompany</string>
    <key>auth_client_id</key>
    <string>TOKEN-ID</string>
    <key>auth_client_secret</key>
    <string>TOKEN-SECRET</string>
  </dict>
  <key>configs</key>
  <array>
    <dict>
      <key>organization</key>
      <string>mycompany</string>
      <key>display_name</key>
      <string>Default</string>
    </dict>
  </array>
</dict>

ほかの Cloudflare One Client 登録がなく、ユーザーがまだ Windows にログインしていない場合、Cloudflare One Client はプレログイン設定を適用します。プレログイン設定が有効なあいだ、デバイスは Team & Resources > Devices にメール non_identity@<team-name>.cloudflareaccess.com で表示されます。

ユーザーが Windows にログインすると、Cloudflare One Client は自動的にデフォルトの MDM 設定へ切り替わり、IdP での認証を求めます。認証が完了すると、Cloudflare One Client はユーザー ID で登録して接続します。Team & Resources > Devices ページには、ユーザーのメールに紐づく新しいデバイスが表示されます。

マルチユーザーモード がオフの場合、このユーザー登録は、次回の Windows ユーザーログイン前を含む、以降のすべての接続に使われます。ユーザー登録を削除すると、ユーザーが Windows からログアウトした時点で、Cloudflare One Client はプレログイン設定に戻ります。

プレログイン設定が マルチユーザーモード とどう連携するかは、Cloudflare One Client の登録フローチャート を参照してください。

役に立ちましたか?