# 1Password Connectサーバーを使い始める

1Password Connect サーバーは、会社のアプリやクラウド インフラストラクチャ内の 1Password アイテムや保管庫に安全にアクセスできるようにする[Secrets Automation ワークフロー](https://developer.1password.com/docs/secrets-automation/)の一種です。

### 必要条件 <a href="#oraxl6nk3ycw" id="oraxl6nk3ycw"></a>

1Password Secrets Automation ワークフローを Connect サーバーとしてCreateする前に、前提条件となるタスクを完了していることを確認してください。タスクは、展開方法によって異なります。

* Docker
  * [1Password ファミリー、チーム、またはビジネス アカウントにサインアップします](https://start.1password.com/sign-up/plan)。
  * Connect サーバーがアクセスするための[Vault をCreateします](https://support.1password.com/create-share-vaults/)。Connect サーバーは、組み込みの[Personal](https://support.1password.com/1password-glossary/#personal-vault) Vault 、[Private](https://support.1password.com/1password-glossary/#private-vault) Vault 、[Employee](https://support.1password.com/1password-glossary/#employee-vault) Vault、またはデフォルトの[Shared](https://support.1password.com/1password-glossary/#shared-vault) Vault にアクセスできません。
  * [Secrets Automation を管理する権限を持つグループ](https://developer.1password.com/docs/connect/manage-connect/)に属していることを確認してください。
  * Docker のデプロイメント環境があることを確認してください。クラウド サービス プロバイダーまたはローカル マシンを使用できます。
* Kubernetes
  * [1Password の家族、チーム、またはビジネス アカウントにサインアップします。](https://start.1password.com/sign-up/plan)
  * Connect サーバーがアクセスするための[Vault をCreateします](https://support.1password.com/create-share-vaults/)。 Connect サーバーは、組み込みの[Personal](https://support.1password.com/1password-glossary/#personal-vault) Vault 、[Private](https://support.1password.com/1password-glossary/#private-vault) Vault 、[Employee](https://support.1password.com/1password-glossary/#employee-vault) Vault、またはデフォルトの[Shared](https://support.1password.com/1password-glossary/#shared-vault) Vault にアクセスできません。
  * [Secrets Automation を管理する権限を持つグループ](https://developer.1password.com/docs/connect/manage-connect/)に属していることを確認してください。
  * [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/)と [Helm](https://helm.sh/) がインストールされた Kubernetes のデプロイ環境があることを確認してください。クラウド サービス プロバイダーまたはローカル マシンを使用できます。

### **Deployment** <a href="#s8p7f9coro3u" id="s8p7f9coro3u"></a>

1Password Connect サーバーを展開するには、次の手順に従います。

#### **ステップ 1: Secrets AutomationワークフローCreate** <a href="#id-24xqxgdzy32" id="id-24xqxgdzy32"></a>

1Password.com ダッシュボードまたは 1Password CLI からConnect Server [Secrets Automation ワークフロー](https://start.1password.com/developer-tools/C)をCreateできます。次の手順に従うと、以下がCreateされます。

* ファイル1password-credentials.json。1Password Connect Server を展開するために必要な資格情報が含まれています。
* アクセス トークン。アプリケーションまたはサービスでこれを使用して、[Connect REST APIで認証します。](https://developer.1password.com/docs/connect/connect-api-reference/)[後で追加のトークンを発行](https://developer.1password.com/docs/connect/manage-connect/#create-a-token)できます。
* 1Password.com

①1Password.com のアカウントに[サインインします。](https://start.1password.com/signin)

②サイドバーから**Developer Tools**を選択します。

③「インフラストラクチャ シークレット管理」で、[「その他」](https://start.1password.com/developer-tools/infrastructure-secrets)を選択します。

④**Create a Connect server**を選択します。

⑤画面の指示に従って1password-credentials.jsonファイルと接続トークンをCreateします。

* 1Password CLI
* [1Password CLI](https://1password.com/downloads/command-line) [op connect command](https://developer.1password.com/docs/cli/reference/management-commands/connect/)を使用して、Connect サーバーで Secrets Automation ワークフローを設定できます。
* ①マシンに [1Password CLI](https://developer.1password.com/docs/cli/get-started/) の最新バージョンがインストールされていることを確認してください。
* ②1password-credentials.json をCreateするディレクトリに切り替えます。
* Connect サーバーをCreateすると、現在のディレクトリに 1password-credentials.json ファイルが自動的に生Createされます。このファイルには、Connect サーバーを展開するために必要な認証情報が含まれています。 1password-credentials.json ファイルが現在のディレクトリに既に存在する場合、1Password CLI はそれを上書きするかどうかを尋ねます。
* ③Connect サーバーをCreateし、[op connect server create command](https://developer.1password.com/docs/cli/reference/management-commands/connect/#connect-server-create)を使用して共有コンテナーへのアクセスを許可します。
* $ op connect server create \<serverName> --vaults \<vaultName>

ヒント

コンテナーへのアクセスを許可せずに Connect サーバーをCreateするには、--vaults フラグを省略します。後で op connect vault Grant コマンドを使用して、Connect サーバーに共有コンテナーへのアクセスを許可できます。

Connect サーバーまたはボルトの名前に 1 つ以上のスペースが含まれている場合は、名前を引用符で囲みます (例: 「My Server Name」)。文字列にスペースが含まれていない場合 (例: myServerName)、文字列を引用符で囲む必要はありません。

op connect server create "My Server Name" --vault "My Vault Name"

④ [op connect token create command](https://developer.1password.com/docs/cli/reference/management-commands/connect/#connect-token)を使用して、Connect サーバーのトークンをCreateします。

$ op connect token create \<tokenName> --server \<serverName|serverID> --vault \<vaultName|vaultID>

ヒント

Connect サーバーをその ID で検索する方が、Connect サーバーの名前を使うより効率的です。 「固有の識別子 (ID)」を参照してください。

op connect server list を実行すると、Connect サーバーの ID を見つけることができます。

Create功すると、1Password CLI は、Connect サーバー REST API での認証にアプリケーションまたはサービスで使用できるトークン文字列を返します。後で追加のトークンを発行できます。

⑤トークンを紛失しないように 1PasswordにSaveしてください。

同じ Connect サーバーに対して複数のトークンを持つことができますが、各 Connect サーバーは独自の異なるトークンのセットを持ちます。 [op connect token command reference](https://developer.1password.com/docs/cli/reference/management-commands/connect/#connect-token)を参照してください。

ヒント

Connect サーバー トークンを環境変数としてエクスポートします。Kubernetes [Injector](https://developer.1password.com/docs/k8s/k8s-injector/)、[Kubernetes Operator](https://developer.1password.com/docs/k8s/k8s-operator/)、その他の統合などの別のツールを構成する場合、これを行うと便利です。ただし、Kubernetes で Connect サーバー トークンを使うには、Kubernetes Secret として使うことが推奨されることに注意してください。

$ export OP\_CONNECT\_TOKEN=\<token>

#### **ステップ2: Deploy 1Password Connect Server** <a href="#sn26rgwm3tvv" id="sn26rgwm3tvv"></a>

* Docker

Docker Composeファイルを使用して Connect サーバーをデプロイするには、次の 2 つの Docker イメージを起動する必要があります。

* [1password/connect-api](https://hub.docker.com/r/1password/connect-api)はConnectサーバーのREST APIを提供します。
* [1password/connect-sync](https://hub.docker.com/r/1password/connect-sync)は、Connectサーバーで利用可能な情報を1Password.comと同期させます。

情報

DockerやDocker Composeに詳しくない場合は、[Docker Composeのドキュメントを参照してください。](https://docs.docker.com/compose/)詳細についてはこちらをご覧ください。

* ①[Docker](https://docs.docker.com/engine/install/)および[Docker Compose](https://docs.docker.com/compose/install/)があなたのマシン上であることを確認してください。
* ②Docker Compose ファイルをCreateして、1password-credentials.json ファイルをSaveしたディレクトリに 1Password Connect Server コンテナをデプロイします。サンプル[docker-compose.yamlファイル](https://i.1password.com/media/1password-connect/docker-compose.yaml)を使うこともできます。<br>
* 資格情報ファイルが他のディレクトリにある場合は、正しい資格情報ファイルの場所を指すようにvolumesセクションを更新します。
* \
  ヒント\
  各コンテナに環境属性を追加することで、docker-compose.yamlファイル内の[Connectサーバーの環境変数](https://developer.1password.com/docs/connect/connect-server-configuration/)を設定できます。これにより、1password-credentials.jsonファイルの場所、ログレベル、HTTPポートなどを指定できます。Docker[環境属性のドキュメントを参照してください。](https://docs.docker.com/compose/environment-variables/set-environment-variables/)詳細についてはこちらをご覧ください。
* ③Dockerが実行中であることを確認してください。Docker[デーモンが実行中かどうか確認できます。](https://docs.docker.com/config/daemon/troubleshoot/#check-whether-docker-is-running)ターミナル アプリケーションでdocker infoコマンドを実行します。
* ④Docker Compose を使用して Docker コンテナを起動します。docker-compose.yamlファイルのあるディレクトリで次のコマンドを実行します。
* $ docker compose up
* ヒント\
  -detachフラグまたは-dフラグを使用してコンテナをバックグラウンドで実行できます。詳細については[docker compose up参照を参照してください。](https://docs.docker.com/engine/reference/commandline/compose_up/)
* \
  デフォルトでは、ローカル ホストの8080ポートを介して Connect REST API にアクセスできます。詳細については、[1Password Connect サーバー API リファレンスを参照してください。](https://developer.1password.com/docs/connect/connect-api-reference/)

**Test the Connect Server REST API**

[curl ](https://curl.se/docs/manpage.html)コマンド、1Password Connect サーバー API エンドポイントの 1 つ、およびCreateしたトークンを使用して、[ConnectサーバーのREST API](https://developer.1password.com/docs/connect/connect-api-reference/) にアクセスできることを確認できます。

* ①Connect サーバー トークンを環境変数としてエクスポートします。これは、[手順 1](https://developer.1password.com/docs/connect/get-started/#step-1)でCreateしたトークンと同じです。または、curlリクエスト内のトークン文字列を$OP\_API\_TOKENに置き換えることもできます。<br>
* ヒント\
  トークンを忘れた場合は、[op connect token createコマンド](https://developer.1password.com/docs/cli/reference/management-commands/connect/#connect-token-create)を使用して別のトークンをCreateできます。
* $ export OP\_API\_TOKEN="\<token>"
* ②Connectサーバーに接続されているデータ保管庫を一覧表示するには、次の例のcurlコマンドを使用します。
* $ curl \\
* -H "Accept: application/json" \\
* -H "Authorization: Bearer $OP\_API\_TOKEN" \\
* <http://localhost:8080/v1/vaults>

Docker コンテナを停止するには、 docker compose downを実行します。

* Kubernetes

Kubernetes を使用して Connect サーバーをデプロイできます。これを行う最も簡単な方法は、[1Password Connect and Operator Helm chart](https://developer.1password.com/docs/k8s/k8s-helm/)を使うことです。

注意

開始する前に、Kubernetes クラスターをデプロイしておく必要があります。クラスターをまだ持っていない場合は、 [minikube ](https://minikube.sigs.k8s.io/docs/start/)を使用してローカルにクラスターをCreateするか、[Play with Kubernetes](https://labs.play-with-k8s.com/) プレイグラウンドを使用できます。

①マシンに [Docker](https://docs.docker.com/engine/install/) がインストールされ、実行されていることを確認してください。

②最新の[Helm](https://helm.sh/)リリースをインストールします。

③1Password Helm チャート リポジトリを追加します。

次のコマンドは、[1Password Helm chart repository](https://developer.1password.com/docs/k8s/k8s-helm/)を Helm のローカル インスタンスに追加します。これにより、1Password の GitHub リポジトリから全てのチャートをダウンロードしてインストールできるようになります。

$ helm repo add 1password <https://1password.github.io/connect-helm-charts/>

④Helm を使用して 1Password Connect サーバーをインストールします。

次のコマンドは、1password-credentials.json ファイルを使用して 1Password Connect サーバーをデプロイします。

ヒント

1password-credentials.json ファイルは、Connect サーバーをCreateしたディレクトリにあります。

$ helm install connect 1password/connect --set-file connect.credentials=1password-credentials.json

**他のデプロイ方法**

Connect サーバーを Kubernetes クラスターにデプロイする方法をいくつか紹介します。

**Helm なしでデプロイする**

Helm チャートを使用せずに Connect サーバーを Kubernetes クラスターにデプロイできます。 [cert-manager](https://cert-manager.io/)を使用して外部ドメインの TLS (トランスポート層セキュリティ) 証明書をプロビジョニングする、1Password の GitHub 上の [sample Kubernetes deployment](https://github.com/1Password/connect/tree/main/examples/kubernetes)を参照してください。

**Kubernetes Operator と一緒にデプロイする**

1Password Connect Kubernetes Operator は、 [Kubernetes Secrets](https://kubernetes.io/docs/concepts/configuration/secret/) を 1Password と統合します。また、1Password アイテムが更新されると、展開が自動的に再起動されます。 [Learn more about the Kubernetes Operator](https://developer.1password.com/docs/k8s/k8s-operator/)。

#### **ステップ3: 1Password から情報を取得するためのアプリケーションとサービスをセットアップする** <a href="#id-929ry01epqn9" id="id-929ry01epqn9"></a>

アプリケーションとサービスは、Connect サーバーへの REST API リクエストを通じて 1Password から情報を取得します。リクエストはアクセス トークンで認証されます。使うアプリケーションまたはサービスごとに[新しいトークンをCreateします。](https://developer.1password.com/docs/connect/manage-connect/#create-a-token)

**言語**

[**​**](https://developer.1password.com/docs/connect/get-started/#languages)

![](/files/tGX8iWhZvpU9G91Cyvci)

[**Go**](https://github.com/1Password/connect-sdk-go)

![](/files/UpdRGWy1QQYfUwQqzBHf)

[Node.js](https://github.com/1Password/connect-sdk-js)

![](/files/rJ8QdwcU6n7CcRN5UwGS)[Python](https://github.com/1Password/connect-sdk-python)

**プラグイン**

[**​**](https://developer.1password.com/docs/connect/get-started/#plugins)

![](/files/W9zuuULvmfGloqRGbIOc)

[Terraform プロバイダー](https://github.com/1Password/terraform-provider-onepassword)

![](/files/bUqyCOC6ZPgHU9HTB3u9)

[Kubernetes 統合](https://developer.1password.com/docs/k8s/k8s-integrations/)

![](/files/fj4ktuqhvSGUAtbYxKrK)

[Hashicorp Vault バックエンド](https://github.com/1Password/vault-plugin-secrets-onepassword)

![](/files/TojvpKicXrh7TiJbB277)

[Ansibleコレクション](https://developer.1password.com/docs/connect/ansible-collection/)

言語またはプラットフォームがリストされていない場合は、[1Password Connect Server REST API を使用して独自のクライアントを構築](https://developer.1password.com/docs/connect/connect-api-reference/)できます。

また、 Connect サーバーで[1Password CLI を使用して](https://developer.1password.com/docs/connect/connect-cli/)、コマンド ラインでシークレットをプロビジョニングし、アイテム情報を取得することもできます。

### **ヘルプを受ける** <a href="#jhfzbhg7n1k3" id="jhfzbhg7n1k3"></a>

トークンがアクセスできる保管庫を変更するには、[新しいトークンを発行します](https://developer.1password.com/docs/connect/manage-connect/#create-a-token)。

ヘルプを受けたりフィードバックを共有したりするには、 [1Password サポート コミュニティ](https://1password.community/categories/secrets-automation/)でのディスカッションに参加してください。


---

# Agent Instructions: 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:

```
GET https://manual.dxable.com/1password/get-started-with-a-1password-connect-server.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
