> For the complete documentation index, see [llms.txt](https://docs.scepman.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.scepman.com/ja/zheng-ming-shu-guan-li/api-certificates/self-service-enrollment/intune-managed-linux-client.md).

# Intune 管理の Linux クライアント

{% hint style="info" %}
SCEPman バージョン 2.9 以降に適用されます
{% endhint %}

{% hint style="warning" %}
SCEPman Enterprise Edition のみ
{% endhint %}

この方法を使うと、Intune によって管理されているユーザーとデバイスの証明書を登録できます。

この場合、Intune は SCEPman REST API を利用するスクリプトをプッシュします。これにより、新しい証明書を登録するか、既存の証明書を更新します。

弊社の開発者 Christoph が、Workplace Ninja Usergroup Germany でこの機能といくつかの背景情報を紹介しました:

{% embed url="<https://www.youtube.com/watch?v=dQcVl1vS3lg>" %}

## 前提条件

### 1. セルフサービス登録

証明書を登録するには、ユーザーは資格を確認するために認証されている必要があります。これを設定する方法については、このガイドの手順に従ってください。

{% content-ref url="/pages/445d23611bcf69e4026fabba99f0bb392434f719" %}
[セルフサービス登録](/ja/zheng-ming-shu-guan-li/api-certificates/self-service-enrollment.md)
{% endcontent-ref %}

### 2. App Service の設定

#### 構成

*証明書更新に必要*

SCEPman App Service が mTLS クライアント証明書を受け入れるように構成します。Settings セクションの Configuration ブレードで、Incoming client certificates の Client certificate mode が次に設定されていることを確認します。 ***任意の対話型ユーザー***.

<figure><img src="https://114237723-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LoGejQeUQcw7lqnQ3WX%2Fuploads%2F9UeFFxwefnV8Cb7Zz14u%2Fimage.png?alt=media&amp;token=210ea9b7-ecd5-4b2b-9641-22447246e718" alt=""><figcaption></figcaption></figure>

Client certificate mode を Require または Allow に設定しないでください。そうすると、SCEP エンドポイントでの SCEPman の通常の動作が壊れてしまいます。

#### 環境変数

このシナリオを使用するには、SCEPman アプリ サービスに次の環境変数を設定する必要があります。

#### [AppConfig:DbCSRValidation:Enabled](https://docs.scepman.com/advanced-configuration/application-settings/dbcsr-validation#appconfig-dbcsrvalidation-enabled)

*証明書の登録と更新に必要*

この変数を次に設定します ***true*** 証明書署名要求 (CSR) の検証を有効にするには、

#### [AppConfig:DbCSRValidation:AllowRenewals](https://docs.scepman.com/advanced-configuration/application-settings/dbcsr-validation#appconfig-dbcsrvalidation-allowrenewals)

*証明書更新に必要*

この変数を次に設定します ***true*** 証明書の更新を有効にするには、

#### [AppConfig:DbCSRValidation:ReenrollmentAllowedCertificateTypes](https://docs.scepman.com/advanced-configuration/application-settings/dbcsr-validation#appconfig-dbcsrvalidation-reenrollmentallowedcertificatetypes)

*証明書更新に必要*

この変数を、更新を許可する証明書の種類のコンマ区切りリストに設定します。使用可能な証明書の種類の一覧については、リンク先の変数のドキュメントを参照してください。

例: ***Static,IntuneUser,IntuneDevice***

このシナリオでは、次の種類の証明書が登録されます ***IntuneUser*** および ***IntuneDevice*** 選択内容によって異なります。

### **3. クライアントの前提条件**

次の前提条件は、Enrollment REST API を使用できるようにするために、実行クライアント/ホスト上に存在している必要があります。

#### [**Azure CLI**](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli) **（バージョン 2.61 以上）**

Azure CLI は、登録するユーザーの認証を行い、対象資格を確認してアクセス トークンを取得するために使用されます。

#### cURL

作成した CSR を SCEPman Enrollment API エンドポイントに送信し、証明書を受け取るために使用します。

#### OpenSSL

OpenSSL は、証明書の登録または更新のための秘密鍵を生成し、CSR を作成するために使用されます。

#### [**Intune への登録**](https://learn.microsoft.com/en-us/mem/intune/user-help/enroll-device-linux)

リンク先のドキュメントに従って、Linux クライアントを Intune に登録してください。

## 登録および更新スクリプト

この [enrollrenewcertificate.sh](https://github.com/scepman/csr-request/blob/main/enroll-certificate/enrollrenewcertificate.sh) このスクリプトは、最初に証明書を取得するため、および定期的に確認し、しきい値に達した場合に更新を試みるために使用されます。

通常、このスクリプトはターミナルでパラメーターを渡して操作しますが、Intune 経由で展開するために一部を修正する必要があります。

ターミナル引数を変数に割り当てている部分を見つけ、必要に応じて調整してください:

設定例:

```bash
APPSERVICE_URL="https://scepman.contoso.net/"
API_SCOPE="api://b7d17d51-8b6d-45eb-b42b-3dae638cd5bc/Cert.Enroll"
CERT_DIR=~/certs
CERT_NAME="myCertificate"
KEY_NAME="myKey"
RENEWAL_THRESHOLD_DAYS=30

# さらに以下の変数を追加します
CERT_TYPE="user"
CERT_COMMAND="auto"
```

#### APPSERVICE\_URL

SCEPman アプリ サービスの URL。

*例: "<https://scepman.contoso.net/>"*

#### API\_SCOPE

これは、環境内の ***SCEPman-api*** アプリ登録で作成できる API スコープです。

ユーザーには希望する同意ダイアログが表示され、その後セルフサービス機能を使用できるようになります。

*例: "api://*&#x62;7d17d51-8b6d-45eb-b42b-3dae638cd5bc/Cert.Enrol&#x6C;*"*

<figure><img src="https://114237723-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LoGejQeUQcw7lqnQ3WX%2Fuploads%2FKWdXwi8JnKGy27tU384e%2Fimage.png?alt=media&amp;token=5173dc4b-8981-40e9-8875-e932078c6667" alt=""><figcaption></figcaption></figure>

#### CERT\_DIR

証明書が作成されるか、更新が試行されるディレクトリです。秘密鍵とルート証明書もここに配置されます。

*例: \~/certs/*

#### CERT\_NAME

更新用に作成または読み取られる証明書のファイル名（拡張子なし）です。

*例: "myCertificate"*

#### KEY\_NAME

更新用に作成または読み取られる秘密鍵のファイル名です。

*例: "myKey"*

#### RENEWAL\_THRESHOLD\_DAYS

スクリプトが更新処理を開始するために、証明書の有効期限まであと何日である必要があるかを表します。

*例: 30*

#### CERT\_TYPE

登録される証明書の種類です。

*"user" または "device" のいずれかです*

#### CERT\_COMMAND

これは、登録と更新に関するスクリプトの動作を定義します:

**"auto"** は、証明書を最初に作成し、すでに存在していて期限切れが近い場合は更新します。

**"renewal"** は、証明書が期限切れ間近であれば更新しますが、最初の証明書作成は行いません。

**"initial"** は、証明書を登録するだけで、既存の証明書の更新は行いません。

{% hint style="warning" %}
デバイス証明書を登録または更新している場合、DeviceId は以下から取得されます *\~/.config/intune/registration.toml* また、認証されたユーザーは、構成された設定内のオブジェクトの所有者と一致している必要があります [DeviceDirectory](https://docs.scepman.com/advanced-configuration/application-settings/intune-validation#appconfig-intunevalidation-devicedirectory).
{% endhint %}

### 注意事項

* このスクリプトは生成されたキーを暗号化しません（これにはパスフレーズの入力が必要なため、自動更新を可能にするため暗号化は省略されています）。
* Certificate Master からパスフレーズで保護された証明書を更新する場合は、それらを更新するためにこのパスフレーズを入力する必要があります。

## スクリプトの展開

Intune を使用すると、修正したスクリプトをスケジュールに従って展開し、指定したパラメーターで最初に証明書を登録し、必要に応じて定期的に更新が必要か確認できます。

新しい Linux スクリプトの展開を追加し、 ***実行コンテキスト*** を ***ユーザー*** を設定し、前のセクションで作成した修正済み bash スクリプトの内容をアップロードまたは貼り付けてください。

を調整し、 ***実行頻度*** を更新のしきい値に合わせてください。

{% hint style="info" %}
ユーザーは、認証が必要なため、最初の実行時に Azure CLI アプリケーションへのログインを求められます。
{% endhint %}


---

# 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://docs.scepman.com/ja/zheng-ming-shu-guan-li/api-certificates/self-service-enrollment/intune-managed-linux-client.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.
