> For the complete documentation index, see [llms.txt](https://help.aikido.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.aikido.dev/docs/docs-ja/autofix-to/configure/autofix-for-azure-devops-with-entra-service-principal.md).

# Entra サービス プリンシパルを使用した Azure DevOps 向け AutoFix

> Personal Access Token や OAuth フローの代わりに、Aikido Autofix を、あなたが所有する Microsoft Entra のサービス プリンシパルとして Azure DevOps に認証させることができます。トークンやシークレットは作成も保存もされません。各修正ごとに、Aikido は Microsoft Entra に対して自身の身元を証明し、Microsoft Entra がサービス プリンシパル用の短命のアクセス トークンを発行します。

> なお、Azure DevOps の組織は Microsoft Entra テナント（'**組織設定**' > '**Microsoft Entra**）に接続されている必要があります。そのテナントでアプリケーションを登録でき、Azure DevOps 組織にユーザーを追加できる必要があります。

**まず**、Aikido の [Autofix 設定](https://app.aikido.dev/settings/integrations/autofix) ページに移動し、「**承認**」の下にある **書き込みアクセス** をクリックして、「**Entra サービス プリンシパルを介して承認**'.

![Aikido Autofix 設定の「Entra サービス プリンシパルを介して承認」オプション](https://715870456-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyKbzcQGrx7UtrG0nPZZ7%2Fuploads%2Fgit-blob-d1d899c85693807db6d44bf9007bde1094f16bde%2Fentra-sp-auth-method-in-aikido.png?alt=media)

サービス プリンシパルの管理ページに移動します。これは [こちら](https://app.aikido.dev/settings/integrations/azure-devops/autofix/service-principal)からも開けます。このページは開いたままにしておいてください。ここには次のセクションで必要な **発行者**, **サブジェクト識別子** と **オーディエンス** が表示されています。

![Aikido のサービス プリンシパル ページにある発行者、サブジェクト識別子、オーディエンスの値](https://715870456-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyKbzcQGrx7UtrG0nPZZ7%2Fuploads%2Fgit-blob-1d62bf6de399811eb4dc1b6f4b49a44aa70836ae%2Fentra-sp-values-in-aikido.png?alt=media)

**次に**、以下の手順に従って Microsoft Entra でサービス プリンシパルを作成し、Azure DevOps でアクセス権を付与します。

## Microsoft Entra でアプリケーションを登録する <a href="#registering-the-application-in-microsoft-entra" id="registering-the-application-in-microsoft-entra"></a>

1. を開き、 [Microsoft Entra 管理センター](https://entra.microsoft.com)に移動して、「**Entra ID**' > '**アプリの登録**」をクリックし、「**新しい登録**'.
2. アプリケーションに名前を付けます。たとえば **Aikido Autofix**、「**シングルテナントのみ**」を選択したままにし、リダイレクト URI は空欄のままにして、「**登録**'.

   ![Microsoft Entra で新しいアプリケーションを登録する](https://715870456-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyKbzcQGrx7UtrG0nPZZ7%2Fuploads%2Fgit-blob-043b18018525692ce1438174b125b4c36e1e1bf2%2Fentra-sp-register-app-in-entra.png?alt=media)
3. アプリケーションの「**概要**」ページで、 **アプリケーション（クライアント）ID** と **ディレクトリ（テナント）ID**をコピーし、両方を Aikido に入力します。
4. 「**証明書とシークレット**' > '**フェデレーション資格情報**」をクリックし、「**資格情報を追加**'.

   ![Entra のアプリ登録内のフェデレーション資格情報タブ](https://715870456-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyKbzcQGrx7UtrG0nPZZ7%2Fuploads%2Fgit-blob-07b64526e8b6664512278fce679040a00b9d859f%2Fentra-sp-federated-creds.png?alt=media)
5. 「**その他の発行者**」を選択し、Aikido のサービス プリンシパル管理ページに表示されている値をそのまま次のように入力します:

   * **発行者**：Aikido に表示されている発行者
   * **種類**：明示的なサブジェクト識別子
   * **値**：Aikido に表示されているサブジェクト識別子
   * **オーディエンス**：「**編集**」をクリックして、既定値を Aikido に表示されているオーディエンスに置き換えます。これにはワークスペース ID が含まれているため、Aikido があなたのワークスペース向けに発行したトークンのみが受け入れられます。

   資格情報に名前を付けます。たとえば **autofix**として、「**追加**」をクリックします。クライアント シークレットや証明書は必要ありません。

   ![Aikido の値を入力したフェデレーション資格情報フォーム](https://715870456-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyKbzcQGrx7UtrG0nPZZ7%2Fuploads%2Fgit-blob-d309798c6578f86ef3774d454465c1ba9377a241%2Fentra-sp-values.png?alt=media)

## Azure DevOps でアクセス権を付与する <a href="#granting-access-in-azure-devops" id="granting-access-in-azure-devops"></a>

1. Azure DevOps で「**組織設定**' > '**ユーザー**」をクリックし、「**ユーザーを追加**'.
2. アプリケーション名（**Aikido Autofix**）を検索し、「**アクセス レベル**」を **Basic**に設定し、Autofix にアクセスが必要なプロジェクトに追加します。次に「**追加**」をクリックします。アプリケーションがまだ表示されない場合は、1分待ってから再度検索してください。

   ![Azure DevOps でサービス プリンシパルをユーザーとして追加する](https://715870456-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyKbzcQGrx7UtrG0nPZZ7%2Fuploads%2Fgit-blob-29005d221afc15201269dc4ea4c00cb55229b405%2Fentra-sp-add-it-as-user.png?alt=media)

> サービス プリンシパルをプロジェクトに追加すると、そのプロジェクトの **共同作業者** グループに追加され、Autofix に必要な権限がすでに付与されます。組織でリポジトリ上の共同作業者が制限されている場合は、 **貢献**, **ブランチの作成** と **プル リクエストへの貢献** について **Aikido Autofix** 各プロジェクトの「**プロジェクト設定**' > '**リポジトリ**' > '**セキュリティ**'.

## Aikido で接続する <a href="#connecting-in-aikido" id="connecting-in-aikido"></a>

1. Aikido のサービス プリンシパル管理ページに戻ります。
2. 先ほどコピーした **ディレクトリ（テナント）ID** と **アプリケーション（クライアント）ID** を挿入し、「**サービス プリンシパルを保存**」をクリックします。Aikido は保存前に Microsoft Entra からトークンを要求し、Azure DevOps 組織のリポジトリにアクセスできることを確認します。

これで準備完了です。これからは [Autofix ページ](https://app.aikido.dev/issues/fix) またはサイドバーのサブ問題のアクション メニューから autofix PR を実行できるようになります。プルリクエストは **Aikido Autofix**.

> Aikido の書き込みアクセスを取り消すには、Microsoft Entra でフェデレーション資格情報を削除するか、Azure DevOps 組織からサービス プリンシパルを削除します。Aikido で設定を削除するには、「**トークンを削除**」を [Autofix 設定](https://app.aikido.dev/settings/integrations/autofix) ページ上で使用します。


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.aikido.dev/docs/docs-ja/autofix-to/configure/autofix-for-azure-devops-with-entra-service-principal.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
