> 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/connect-private-packages/nuget-private-packages.md).

# NuGet - プライベートパッケージ

Aikido が private packages を含む依存関係を更新するには、正確な lockfile の更新を生成できるように、プライベート NuGet レジストリへのアクセスが必要です。

Aikido では、プライベート NuGet レジストリとの接続を設定する方法が 2 通りあります：

1. 〜を介して `nuget.config` ファイル
2. dotnet CLI の資格情報を介して

## 1. nuget.config ファイルによる設定 <a href="#id-1-configuration-via-nugetconfig-file" id="id-1-configuration-via-nugetconfig-file"></a>

### 前提条件 <a href="#prerequisites" id="prerequisites"></a>

プライベート NuGet パッケージの場合、Aikido は `nuget.config` プライベートレジストリで認証するための `nuget.config` ファイルを使用します。このファイルは、リポジトリのルートにある

例 `nuget.config` GitHub の NuGet レジストリ上のプライベートパッケージにアクセスするための：

```
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <clear />
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
    <add key="github" value="https://nuget.pkg.github.com/AikidoSec/index.json" />
  </packageSources>
  <packageSourceCredentials>
    <github>
      <add key="Username" value="AikidoSec" />
      <add key="ClearTextPassword" value="ghp_ABC123...XYZ" />
    </github>
  </packageSourceCredentials>
</configuration>
```

プライベート NuGet レジストリでの認証の詳細については、以下のドキュメントをご覧ください。

* [Microsoft - 認証済みフィードからパッケージを取得する](https://learn.microsoft.com/en-us/nuget/consume-packages/consuming-packages-authenticated-feeds)
* [GitHub - NuGet レジストリの使い方](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-nuget-registry)

## Aikido での設定 <a href="#configuration-in-aikido" id="configuration-in-aikido"></a>

前提条件が満たされたら、以下の手順に従って、依存関係を更新する際に Aikido がプライベート NuGet レジストリで認証するよう設定できます：

1. Aikido の Autofix のアカウント設定ページに移動し、 [こちら](https://app.aikido.dev/issues/fix/settings).
2. 「Connect Registry」をクリックすると、プライベートレジストリのモーダルが表示されます

<div data-with-frame="true"><figure><img src="/files/93d539d9c2979772d40a2c418b778a2cd588532f" alt=""><figcaption></figcaption></figure></div>

3. パッケージマネージャーとして「NuGet」を選択し、 `nuget.config` オプションを選択します

<div data-with-frame="true"><figure><img src="/files/cc501ea508cf23b96cb5bb132dfbe4b1597cc1dc" alt=""><figcaption></figcaption></figure></div>

4. あなたの `nuget.config` ファイルに認証情報を入力します。Aikido は、実際に使用される直前まで設定ファイルを安全に暗号化します。
5. 「Connect Registry」をクリックして設定を保存します

## 2. .NET の nuget CLI による設定 <a href="#id-2-configuration-via-nets-nuget-cli" id="id-2-configuration-via-nets-nuget-cli"></a>

CLI 設定の場合、Aikido にはレジストリの URL、ユーザー名、パスワードが必要で、これを使ってプライベートレジストリで認証できます。この情報があれば、以下の手順で設定できます：

1. Aikido の Autofix のアカウント設定ページに移動し、 [こちら](https://app.aikido.dev/issues/fix/settings).
2. 「Connect Registry」をクリックすると、設定モーダルが表示されます
3. パッケージマネージャーとして「NuGet」を選択し、その後「NuGet CLI Registry」オプションを選択します

<div data-with-frame="true"><figure><img src="/files/23a53a586d56fc91b1fc599587517b6ebcb331cc" alt=""><figcaption></figcaption></figure></div>

4. 入力欄に詳細を入力し、「Connect Registry」をクリックして設定を保存します

## 3. 環境変数による設定

NuGet では、Autofix の環境変数を通じて資格情報を提供することもできます。

これには `nuget.config` リポジトリ内にプライベートフィードを定義するファイルが必要です。環境変数内のフィード名は `nuget.config`.

1. Aikido の Autofix のアカウント設定ページに移動し、 [こちら](https://app.aikido.dev/issues/fix/settings).
2. 次の環境変数を追加します：
   1. キー： `NuGetPackageSourceCredentials_my-private-feed`
   2. 値： `Username=user;Password=secret-pat`

PAT にはパッケージの読み取り権限が必要です。

<div data-with-frame="true"><figure><img src="/files/ba1d02b0d8e5223684d66c4009bd4bd12f68e2df" alt=""><figcaption></figcaption></figure></div>


---

# 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://help.aikido.dev/docs/docs-ja/autofix-to/connect-private-packages/nuget-private-packages.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.
