> For the complete documentation index, see [llms.txt](https://docs.keeper.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.keeper.io/keeperpam/jp/privileged-access-manager/references/importing-pam-resources/using-a-csv-template.md).

# CSVテンプレートの使用

CSVデータとJSONテンプレートを使用した、検証済みKeeperPAMインポートの作成

## インポート方法の選択 <a href="#choose-an-import-path" id="choose-an-import-path"></a>

Keeperコマンダーには、CSVからJSONへ変換する2つのワークフローがあります。

1. **CSVのみ:** CSVの値から `pamMachine`、`pamDirectory`、`pamUser` の各レコードをそのまま作成します。
2. **CSVとJSONテンプレートの併用:** 接続、ローテーション、PAM構成の共通設定をテンプレートで適用し、マシンおよびユーザー固有の値をCSVで指定します。

SSH、RDP、データベースへの接続を利用できるインポートには、JSONテンプレートを使用してください。CSVのみのインポートでは、マシンの管理ポート、OS、セッションプロトコル、認証情報のマッピングを自動的に判定できません。

## インポート前の検証 <a href="#validate-before-importing" id="validate-before-importing"></a>

PAMプロジェクトを作成する前に、必ず生成されたJSONを検証してください。

```bash
pam project import --filename /absolute/path/pam_import.json --name "My PAM Project" --dry-run
```

絶対パスを指定してください。Commanderのコマンドで `~` 展開を使用しないでください。`--dry-run` を外して実行する前に、ドライランで想定どおりのリソース数とユーザー数が報告されることを確認してください。

検証やトラブルシューティングについて詳しくは、[PAMプロジェクトインポートの検証](/keeperpam/jp/privileged-access-manager/references/importing-pam-resources/validate-a-pam-project-import.md)をご参照ください。

## CSVのみでのインポート <a href="#csv-only-imports" id="csv-only-imports"></a>

### 必須項目 <a href="#required-fields" id="required-fields"></a>

CSVに最低限必要な列は以下のとおりです。

| hostname          | username      | user\_path        | password           |
| ----------------- | ------------- | ----------------- | ------------------ |
| DESKTOP-001.local |               |                   |                    |
|                   | Administrator | DESKTOP-001.local | REPLACE-BEFORE-USE |

`user_path` は、ユーザーが属するリソースを示します。この例では、`DESKTOP-001.local` という名前のマシンと、その配下に `DESKTOP-001.local - Administrator` という名前のPAMユーザーが作成されます。

以下は、CSVのみを使った最小限のインポートで作成される、最小構成のリソースの例です。

```json
{
  "title": "DESKTOP-001.local",
  "type": "pamMachine",
  "host": "DESKTOP-001.local",
  "pam_settings": {
    "options": {
      "rotation": "off",
      "connections": "on",
      "tunneling": "off",
      "graphical_session_recording": "on"
    },
    "connection": {}
  },
  "users": [
    {
      "title": "DESKTOP-001.local - Administrator",
      "login": "Administrator",
      "password": "REPLACE-BEFORE-USE",
      "type": "pamUser"
    }
  ]
}
```

このレコードには、対話的な接続やパスワードローテーションの設定はまだ含まれていません。必要な高度なフィールドを追加するか、JSONテンプレートを使用してください。

### 空のローテーション設定を使用しない <a href="#do-not-use-empty-rotation-settings" id="do-not-use-empty-rotation-settings"></a>

ローテーションを設定しない場合は、`rotation_settings` を省略してください。空のオブジェクトは使用しないでください。

```json
"rotation_settings": {}
```

影響を受けるバージョンのCommanderでは、空のオブジェクトがローテーション要求として解釈されます。その結果、`Failed to load rotation schedule` という警告が発生し、最初のリソースを処理した時点でインポートが停止することがあります。ローテーションを使用する場合のみ、完全なローテーション設定を指定してください。

`pam_import_generator_v2.py` の一部のバージョンでは、CSVのみの出力に対して空の `rotation_settings` オブジェクトが出力されます。ローテーションを設定しない場合は、インポート前に生成されたJSONからこのプロパティを削除してください。

## 高度なCSVフィールドで実用的なマシンを構成する <a href="#configure-usable-machines-with-advanced-csv-fields" id="configure-usable-machines-with-advanced-csv-fields"></a>

実際に使用できるマシンには、管理用ポートと対話的セッションの設定の両方が必要です。

* `rs.port`: 管理用またはローテーション用のポート (`22`、`5985`、`5986` など)
* `rs.operating_system`: マシンのOS
* `rs.pam_settings.connection.protocol`: 対話的プロトコル (`ssh` または `rdp` など)
* `rs.pam_settings.connection.port`: 対話的セッションのポート (SSHは `22`、RDPは `3389` など)
* `rs.pam_settings.connection.administrative_credentials`: 管理操作に使用するPAMユーザーのタイトルまたはログイン名
* `rs.pam_settings.connection.launch_credentials`: 接続の起動に使用するPAMユーザーのタイトルまたはログイン名
* `rs.pam_settings.connection.allow_supply_user`: 起動用認証情報が選択されていない場合に、セッションユーザーがユーザー名を指定できるようにするかどうか

以下は、WinRMの管理用ポートとRDPのセッションポートを持つWindowsマシンの例です。

```csv
hostname,username,user_path,password,rs.port,rs.operating_system,rs.ssl_verification,rs.pam_settings.connection.protocol,rs.pam_settings.connection.port,rs.pam_settings.connection.allow_supply_user,rs.pam_settings.connection.administrative_credentials,rs.pam_settings.connection.launch_credentials
DESKTOP-001.local,,,,5986,Windows,true,rdp,3389,true,DESKTOP-001.local - Administrator,DESKTOP-001.local - Administrator
,Administrator,DESKTOP-001.local,REPLACE-BEFORE-USE,,,,,,,,
```

認証情報の参照先は、一意なPAMユーザーのタイトルまたはログイン名と一致させる必要があります。CSVジェネレーターは、重複するユーザー名をグローバルに重複排除できるため、複数のローカルアカウントを生成する場合は、ユーザーのタイトルとユーザー名を一意にしてください。

その他のフィールドは、リソースに `rs.`、ユーザーに `usr.` の接頭辞を付けて、以下のように指定できます。

```
rs.port
rs.operating_system
rs.pam_settings.connection.protocol
rs.pam_settings.connection.administrative_credentials
usr.distinguished_name
usr.rotation_settings.enabled
```

`folder_path` は `pam project extend` でのみ使用され、`pam project import` では無視されます。

## JSONテンプレートとCSVの併用 <a href="#csv-with-a-json-template" id="csv-with-a-json-template"></a>

マシン間で設定を共有する場合は、JSONテンプレートを使用してください。テンプレートではプロジェクト、PAM構成、マシンのデフォルト設定を定義し、CSVではホストおよびユーザー固有の値を指定します。

マシンテンプレートには、完全な接続設定を含める必要があります。以下は、その例です。

```json
{
  "type": "pamMachine",
  "title": "xxx:server",
  "host": "xxx:server",
  "port": "5986",
  "ssl_verification": true,
  "operating_system": "Windows",
  "pam_settings": {
    "options": {
      "rotation": "on",
      "connections": "on",
      "tunneling": "on",
      "graphical_session_recording": "on"
    },
    "connection": {
      "protocol": "rdp",
      "port": "3389",
      "allow_supply_user": true,
      "administrative_credentials": "Example AD.DomainAdmin",
      "launch_credentials": "Example AD.DomainAdmin",
      "security": "any",
      "ignore_server_cert": true
    }
  },
  "users": [
    {
      "type": "pamUser",
      "title": "xxx:admin",
      "login": "xxx:Administrator",
      "password": "REPLACE-BEFORE-USE"
    }
  ]
}
```

`XXX:` で始まる値は、実際の固定の設定値に置き換えてください。`xxx:` で始まる値は、CSVのデータに置き換えられるプレースホルダーです。PAMディレクトリや共有認証情報の設定を含むインポートを行う場合は、[PAMリソースのインポート](/keeperpam/jp/privileged-access-manager/references.md)にある完全なテンプレートを使用してください。

## 変換の実行 <a href="#run-the-conversion" id="run-the-conversion"></a>

[pam\_import\_generator\_v2.py](https://github.com/Keeper-Security/Commander/blob/master/examples/pam_import_generator_v2.py)をダウンロードし、CSVファイルおよび (使用する場合は) `import_template.json` と同じフォルダに保存します。

```bash
python3 pam_import_generator_v2.py --input-file servers_to_import.csv --output-file pam_import.json
```

JSONテンプレートを使用する場合は、以下のコマンドを実行します。

```bash
python3 pam_import_generator_v2.py --input-file servers_to_import.csv --template-file import_template.json --output-file pam_import.json --prefix-names
```

プロジェクトを作成する前に、前述のとおり生成されたファイルに対して `--dry-run` を実行してください。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.keeper.io/keeperpam/jp/privileged-access-manager/references/importing-pam-resources/using-a-csv-template.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
