> 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 による登録

Microsoft Identities を認証に使用するこの REST API を使用して、SCEP 形式の認証を必要とする SCEP エンドポイントの代替として証明書を登録します。

{% 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 モジュールから実行して、必要な権限を割り当てます。

例:

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

*ServicePrincipalId*

この ***オブジェクト ID*** 対応する ***エンタープライズ アプリケーション*** 前の手順で作成したアプリ登録のものです。なお、これは通常 SCEPman-api という名前の、SCEPman 自体を識別するエンタープライズ アプリケーションを指すものではありません。

この権限を手動で割り当てるには、次の場所に移動できます。 *API 権限* へ進み、 *組織で使用している権限*。次の ***CSR.Request.Db*** からの権限を ***SCEPman-api*** として *アプリケーション権限*.

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

*Service Principals* には、Graph の権限 ***Application.Read.All*** も必要です。これは、認証のために SCEPman の API スコープを自動取得できるようにするためです。

権限は次のように手動で追加できます。

<figure><img src="https://114237723-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LoGejQeUQcw7lqnQ3WX%2Fuploads%2FDcTPqAoP7o03QirKhyMH%2Fimage.png?alt=media&amp;token=7233bb9a-a9c1-49aa-9cbc-21f90931c59c" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

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

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

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

## 証明書の登録

前提条件を準備したら、HTTP パスを使って SCEPman に PKCS#10/CMS を 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 上のオープンソース サンプル ライブラリ](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.
