> 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/commander-cli/command-reference/secrets-manager-commands/secrets-manager-token-add.md).

# シークレットマネージャー トークン追加

## 概要

`secrets-manager token add` サブコマンドは、既存のKeeperシークレットマネージャー (KSM) アプリケーションにワンタイムアクセストークンを追加します。アプリケーションを作り直さずにトークンだけを発行したい場合のショートカットです。

{% hint style="info" %}
**対象バージョン:** Keeperコマンダー17.3以降
{% endhint %}

***

### 構文

```
secrets-manager token add <APP_UID_OR_NAME> [options]
```

以下と同等です。

```
secrets-manager client add --app <APP_UID_OR_NAME> [options]
```

出力は `secrets-manager client add` と同じです。 `secrets-manager` のヘルプに `token` 用のサブコマンドがまとめて表示されるため、目的の操作にたどり着きやすくなっています。

***

### パラメータ

| パラメータ               | 必須 | 説明                      |
| ------------------- | -- | ----------------------- |
| `<APP_UID_OR_NAME>` | はい | 既存のKSMアプリケーションのUIDまたは名前 |

***

### オプション

| オプション                               | 型   | デフォルト | 説明                             |
| ----------------------------------- | --- | ----- | ------------------------------ |
| `--count <n>`                       | 整数  | 1     | 作成するワンタイムトークン数                 |
| `--unlock-ip`                       | フラグ | false | 生成したトークンのIPロックを外す              |
| `--first-access-expires-in-min <n>` | 整数  | —     | 初回アクセス前に失効するまでの分数              |
| `--access-expire-in-min <n>`        | 整数  | —     | 初回アクセス後に失効するまでの分数              |
| `--name <label>`                    | 文字列 | —     | 生成するクライアントの表示名                 |
| `--config-init <type>`              | 文字列 | —     | 構成初期化の出力形式（`k8s`、`json`、`b64`） |
| `--return-tokens`                   | フラグ | false | 呼び出し元に生のトークン文字列を返す（スクリプト向け）    |

***

### 使用例

#### 単一のトークンをアプリケーションに追加する

```
My Vault> secrets-manager token add MyApp
Token generated for application 'MyApp'.
  Token: US:AAA...
```

#### 複数のトークンを生成する

```
My Vault> secrets-manager token add MyApp --count 3
```

#### 未使用のまま30分で失効するトークンを生成する

```
My Vault> secrets-manager token add MyApp --first-access-expires-in-min 30
```

#### スクリプトでトークン値を取得する

```bash
TOKEN=$(keeper secrets-manager token add MyApp --return-tokens)
echo "Token: $TOKEN"
```

#### Kubernetes向けの構成出力でトークンを生成する

```bash
keeper secrets-manager token add MyApp --config-init k8s --name ci-runner-token
```

***

### 注記

* アプリケーションはあらかじめ存在している必要があります。新しいKSMアプリケーションを作成するときは、 `secrets-manager app create <NAME>` を使用します。
* `--unlock-ip` で生成したトークンは、発行元マシンのIPアドレスに紐づきません。
* `--return-tokens` はスクリプトでの利用を想定しています。指定しない場合、トークンは通常のコマンド出力の一部として標準出力に表示されます。
* 実装は `KSMCommand.add_client()` に集約されており、APIとしての新規追加はありません。


---

# 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/commander-cli/command-reference/secrets-manager-commands/secrets-manager-token-add.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.
