> 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/aikido-device-protection/deploying-aikido-endpoint/device-protection-mdm-guides/linux/device-protection-in-azure-pipelines.md).

# Azure Pipelines での Device Protection

Azure Pipelines のジョブは Linux エージェント上で実行されるため、Device Protection は他の Linux マシンと同じ方法でインストールされます。Azure Pipelines に固有なのは、どこにインストールされるかです。常駐するセルフホスト エージェントに 1 回だけインストールするか、Microsoft ホスト型エージェントでは各ジョブ内でインストールします。

まず [Linux 用 Device Protection をインストールする](/docs/docs-ja/aikido-device-protection/deploying-aikido-endpoint/device-protection-mdm-guides/linux/install-device-protection-for-linux.md) トークンとインストール方式についてお読みください。以下のジョブレベルのスニペットでは container 方式を使用しており、これは [コンテナ内の Device Protection](/docs/docs-ja/aikido-device-protection/deploying-aikido-endpoint/device-protection-mdm-guides/linux/device-protection-in-containers.md) を説明しています。

## Microsoft ホスト型エージェント

Device Protection トークンを、次の名前のシークレット変数として追加します `AIKIDO_TOKEN`その後、パッケージをインストールするステップの前にエージェントを起動します:

{% code title="azure-pipelines.yml" overflow="wrap" %}

```yaml
pool:
  vmImage: ubuntu-latest

steps:
  - script: |
      curl -fsSL https://github.com/AikidoSec/safe-chain/raw/refs/heads/main/install-scripts/install-endpoint-linux.sh \
        | sudo AIKIDO_TOKEN="$AIKIDO_TOKEN" sh -s -- --container
      sudo aikido-endpoint-protection-start --wait-for-healthy
    displayName: Device Protection を開始
    env:
      AIKIDO_TOKEN: $(AIKIDO_TOKEN)

  - script: |
      for f in /etc/profile.d/aikido-*.sh; do . "$f"; done
      npm ci
    displayName: 依存関係をインストール
```

{% endcode %}

* **シークレットを次の下にマップします `env`.** Azure Pipelines では、シークレット変数が単独でステップに公開されることはありません。
* **トークンはの後に渡します `sudo`.** `sudo` 残りの環境変数は失われます。
* **ソース `/etc/profile.d/aikido-*.sh` パッケージをインストールするすべてのステップで。** 各ステップは新しいシェルであり、それらの設定がないとダウンロード時にエージェントがスキップされます。
* **runner は VM ですが、 `--container`.** ジョブから runner を再起動することはできず、container モードでは再起動も不要です。そのため、エージェントは明示的に起動します。参照: [インストール方式を選択](/docs/docs-ja/aikido-device-protection/deploying-aikido-endpoint/device-protection-mdm-guides/linux/install-device-protection-for-linux.md#choose-the-install-flavor).

## セルフホスト エージェント

エージェント ホストにエージェントを次を使ってインストールします `--headless`付きでインストールし、その後再起動します。参照: [Linux 用 Device Protection をインストールする](/docs/docs-ja/aikido-device-protection/deploying-aikido-endpoint/device-protection-mdm-guides/linux/install-device-protection-for-linux.md#choose-the-install-flavor).

## 動作確認

{% code title="azure-pipelines.yml" overflow="wrap" %}

```yaml
  - script: |
      for f in /etc/profile.d/aikido-*.sh; do . "$f"; done
      curl -sS -o /dev/null -w "%{http_code}\n" --max-time 15 https://registry.npmjs.org/safe-chain-test/-/safe-chain-test-0.0.1-security.tgz
    displayName: Device Protection を確認
```

{% endcode %}

`403` は、エージェントがマルウェアのテスト用パッケージをブロックしたことを意味します。 `200` は、ダウンロードがエージェントを回避したことを意味します。

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

| 問題                                                | 修正                                                                                 |
| ------------------------------------------------- | ---------------------------------------------------------------------------------- |
| `トークンが必要です`                                       | シークレットをステップの次の下にマップします `env`、その後に渡します `sudo`。フォークされた pull request にはシークレットが付与されません |
| `root 権限が必要です`                                    | インストールと開始コマンドの前に `sudo`                                                            |
| テストパッケージが返す `200`、または `SELF_SIGNED_CERT_IN_CHAIN` | そのステップでは source が読み込まれませんでした `/etc/profile.d/aikido-*.sh`                          |


---

# 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/aikido-device-protection/deploying-aikido-endpoint/device-protection-mdm-guides/linux/device-protection-in-azure-pipelines.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.
