> 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/api-enrollment.md).

# API 登録

{% hint style="info" %}
この機能にはバージョン **2.3.689** 以上が必要です。
{% endhint %}

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

SCEPman には、証明書を登録するための REST API があります。これは、SCEP 形式の認証を必要とする SCEP エンドポイントの代替であり、REST API は認証に Microsoft Identities を使用します。プロトコルも SCEP よりはるかにシンプルです。

## 前提条件

### 1. Service Principal

{% stepper %}
{% step %}

### アプリ登録

新しい *アプリ登録* を作成して、ユースケースを説明してください。あなたのアプリケーションは、このアプリケーションとして SCEPman に対して認証します。
{% endstep %}

{% step %}

### API アクセス許可

#### CSR.Request.Db

次のものを実行して、必要なアクセス許可を割り当てます。 **Register-SCEPmanApiClient** SCEPman PowerShell モジュールの cmdlet。

例:&#x20;

```powershell
Register-SCEPmanApiClient -ServicePrincipalId xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
```

*ServicePrincipalId*

この ***オブジェクト ID*** を持つ対応する ***Enterprise Application*** 前の手順で作成した App Registration の。これは通常 SCEPman-api と呼ばれる Enterprise Application ではなく、SCEPman 自体を識別するものなので注意してください。

このアクセス許可を手動で割り当てるには、次の場所に移動できます。 *API アクセス許可* そして、次の項目からアクセス許可を追加します。 *組織で使用しているアクセス許可*を使用して行えます。使用しているアカウントに ***CSR.Request.Db*** からのアクセス許可 ***SCEPman-api*** を *アプリケーションのアクセス許可*.

#### Application.Read.All (オプション)

*Service Principals* には、次の Graph のアクセス許可も必要です。 ***Application.Read.All*** 認証のために SCEPman の API スコープを自動的に取得できるようにするためです。

アクセス許可は次のように手動で追加できます。

<figure><img src="/files/040a3d093f815d0aa0af0d4f95f97ea4b7b72c86" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### クライアント シークレット

「Certificates & Secrets」 の下でクライアント シークレットを作成します。クライアント シークレットは、後でアプリケーションを認証するためのパスワードとして使用されます。
{% endstep %}
{% endstepper %}

### 2. App Service Settings

#### Configuration

*証明書更新に必要*

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

<figure><img src="/files/dc71dff51639e03c965715c106ab3d01f5851822" alt=""><figcaption></figcaption></figure>

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

#### Environment Variables

このシナリオを利用するには、SCEPman app service に次の環境変数を設定する必要があります。

#### [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***

## 証明書の登録

前提条件を準備したら、HTTP パスを使用して PKCS#10/CMS を SCEPman に POST できます *api/csr*。HTTP レスポンスには、新しく発行された証明書が DER エンコードで返されます。

SCEPman は、発行されたすべての証明書を Storage Account に自動的に保存するため、Certificate Master コンポーネントを使って簡単に一覧表示したり失効させたりできます。

それらのリクエストを送信する便利な方法として、SCEPmanClient PowerShell モジュールがあります。

{% content-ref url="/pages/bf7351c033e552bb4765454f3191e59e17971340" %}
[SCEPmanClient](/ja/zheng-ming-shu-guan-li/api-certificates/scepmanclient.md)
{% endcontent-ref %}

## その他の例

こちらをご覧ください [GitHub 上の Open Source Sample Library](https://github.com/scepman/csr-request) SCEPman の REST API の使用方法を確認してください。


---

# 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/api-enrollment.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.
