> ## Documentation Index
> Fetch the complete documentation index at: https://docs.enclave.ai/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Enclave in these docs is the code and cloud security platform at enclave.ai. It is not Open Enclave, Intel SGX or other hardware enclaves, or enclave.gg.
> People use Enclave in the web app at https://app.enclave.ai or the desktop app. These docs describe no public Enclave API or CLI, so don't invent endpoints, commands, or config files.
> Connecting an integration needs a person to sign in and approve access in a browser. Tell the user the exact step to take instead of saying you completed it.

# Azure DevOps

> Azure DevOps の組織を接続して、Enclave が Azure Repos のリポジトリを読み取り、学習できるようにします。

Azure DevOps を接続すると、Enclave は Azure DevOps の組織にあるリポジトリを読み取り、学習できます。

## 始める前に

Enclave で **Owner** または **Admin** ロールが必要です。

Azure DevOps では、接続に使うアカウントに、スキャン対象のプロジェクトでの **Project Administrator** 、または **Edit Subscription** 権限が必要です。Enclave はこの権限を使って、プッシュイベントを送信するサービスフックを作成します。この権限がないと、Enclave はコードを読み取れますが、新しいコミットを把握できません。

## Azure DevOps を接続する

**1. インテグレーションを開く**

[app.enclave.ai](https://app.enclave.ai) で **Settings → Integrations** を開きます。 **Azure DevOps** の横にある **Connect** をクリックします。

**2. サインイン方法を選ぶ**

Azure DevOps へのサインイン方法に合ったオプションを選びます。

> [tab] Microsoft Entra ID
>
> 職場または学校のアカウントの場合に使います。
>
> 1. **Microsoft Entra ID** をクリックし、Microsoft でサインインします。
> 2. **Choose organizations to connect** で、Enclave に読み取らせる Azure DevOps の組織を選びます。
> 3. **Connect** をクリックします。
>
> 組織は後から追加で接続できます。

> [tab] 個人用アクセストークン
>
> 個人の Microsoft アカウントでサインインする場合に使います。Microsoft Entra ID は、個人アカウント向けにトークンを発行できません。
>
> 1. Azure DevOps で、コードの読み取り、プロジェクトの一覧表示、サービスフックの管理ができる個人用アクセストークンを作成します。Azure DevOps のトークン画面では、バージョンによってこれらの権限のまとめ方が異なります。 [Microsoft のトークンスコープのリファレンス](https://learn.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate) を参照してください。
>
> 2. Enclave で **Personal access token** をクリックします。
>
> 3. **Organization** を入力します。これは `dev.azure.com/<organization>` のパス部分です。
>
> 4. トークンを貼り付け、 **Validate & connect** をクリックします。
>
> > [!TIP]
> >
> > 個人のトークンではなく、サービスアカウントのトークンを使ってください。アクティビティは、トークンを所有するアカウントの名前で表示されます。

**3. 接続を確認する**

**Settings → Integrations → Azure DevOps** に戻ると、 **Organizations** に組織がリポジトリ数とともに表示されます。

## 権限

Enclave は、この接続を使って次のことを行います。

* **リポジトリ、ブランチ、プルリクエストを読み取ります。** Enclave はコードとその履歴を読み取ります。
* **サービスフックのサブスクリプションを作成・削除します。** Enclave はプッシュとプルリクエストのイベントをサブスクライブし、コードの変更を把握します。
* **検出結果に対応する Azure Boards の作業項目を作成・更新します。** これには **Work Items (read & write)** 権限が必要です。Azure DevOps を接続すると、Azure Boards も接続されます。別途セットアップする必要はありません。

## 接続を管理する

**Settings → Integrations → Azure DevOps** を開くと、接続済みの組織を確認できます。

* **Resync** は、接続後に作成されたプロジェクトとリポジトリを取り込みます。Azure DevOps は作成時に Enclave へ通知しないため、追加したら **Resync** をクリックしてください。権限を修正した後の再確認にも使えます。
* **Add organization** は、別の Azure DevOps の組織を接続します。
* **Remove** は、組織の接続を解除します。Enclave はその組織のリポジトリのスキャンを停止します。後から再接続できます。

## トラブルシューティング

> [accordion] 組織に「push events not active」と表示される
>
> Enclave はリポジトリを読み取れましたが、サービスフックを作成できませんでした。接続に使ったアカウントに、プロジェクトでの **Edit Subscription** （または **Project Administrator** ）を付与し、 **Resync** をクリックします。

> [accordion] 組織に「Azure Boards unavailable」と表示される
>
> この接続では作業項目を作成できません。 **Work Items (read & write)** を付与し、 **Resync** をクリックします。

> [accordion] 新しいプロジェクトやリポジトリが表示されない
>
> 組織の **Resync** をクリックします。大規模な組織では、クリック後も再同期が続きます。リポジトリは同期が進むにつれて表示されます。

> [accordion] トークンの検証に失敗する
>
> * **Azure DevOps rejected this token** ：トークンの有効期限が切れたか、取り消されています。新しいトークンを作成します。
> * **This token can't do everything Enclave needs** ：コードの読み取り、プロジェクトの一覧表示、サービスフックの管理ができるようにトークンを作り直します。
> * **This token authenticated but can't see any projects** ： **Project Settings → Permissions** で、トークンの所有者をプロジェクトに追加します。
> * **We couldn't reach that Azure DevOps organization** ：組織名とネットワークのルールを確認します。

> [accordion] 組織に「reconnect needed」と表示される
>
> Enclave は、この接続の認証情報を使えなくなっています。組織を削除して、もう一度接続します。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.