> 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/scepman-no/intermediate-certificate.md).

# 中間 CA

SCEPmanを従属認証局として構成します。

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

別のルート CA を引き続き主認証機関として使用する場合は、中間 CA を使用します。SCEPman は Azure Key Vault でキーと証明書要求を作成します。ルート CA が要求に署名します。

### 始める前に

証明書を作成する前に、次の前提条件を満たしてください。

* 管理者アカウントに、SCEPman の Key Vault で証明書要求を作成し、署名済み証明書をマージする権限があること。
* Azure CLI と PowerShell を実行するシステムから Key Vault にアクセスできること。
* 必要な中間 CA のサブジェクトと証明書名がわかっていること。

<details>

<summary>Key Vault の証明書アクセス許可を付与する</summary>

{% tabs %}
{% tab title="Azure RBAC" %}

1. Key Vault で、 **アクセス制御 (IAM)** → **ロールの割り当て**.
2. を追加し、 **Key Vault 証明書管理者** ロールを割り当てます。
3. CSR を作成する管理者アカウントにロールを割り当てます。

<figure><img src="https://114237723-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LoGejQeUQcw7lqnQ3WX%2Fuploads%2FZUqsPTRdUk5IhmZZlBVD%2Fimage.png?alt=media&amp;token=325c2296-4f6b-476d-b003-29cf3674556f" alt="Add a role assignment in the Key Vault"><figcaption><p>Key Vault でロールの割り当てを追加します。</p></figcaption></figure>

<figure><img src="https://114237723-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LoGejQeUQcw7lqnQ3WX%2Fuploads%2FptcaAY0strUu3qIgkTdc%2Fimage.png?alt=media&amp;token=6bf4adc2-da77-4ece-ba68-09c61fc6905e" alt="Select the Key Vault Certificate Officer role"><figcaption><p>Key Vault 証明書管理者ロールを選択します。</p></figcaption></figure>
{% endtab %}

{% tab title="Vault アクセス ポリシー" %}

1. Key Vault で、 **アクセス ポリシー** を開き、 **作成**.
2. を選択します。 **証明書の管理** テンプレートを選択します。
3. CSR を作成する管理者アカウントにポリシーを割り当てます。

<figure><img src="https://114237723-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LoGejQeUQcw7lqnQ3WX%2Fuploads%2FD2mWeiZ7YnQuRN0rdypW%2F2023-06-14%2016_20_43-IntermediateCert.png?alt=media&amp;token=da6b385e-8902-4b53-8a9f-25f3573d6532" alt=""><figcaption></figcaption></figure>

<figure><img src="https://114237723-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LoGejQeUQcw7lqnQ3WX%2Fuploads%2F37QHfqcQRHNboM4yQkTb%2F2023-06-14%2016_23_37-IntermediateCert.png?alt=media&amp;token=3cc22a95-8f13-4487-b270-083efa2779bd" alt=""><figcaption></figcaption></figure>

<figure><img src="https://114237723-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LoGejQeUQcw7lqnQ3WX%2Fuploads%2FIj3S2D7wkNquLnBJSUQe%2F2023-06-14%2017_06_33-.png?alt=media&amp;token=195c03cb-a120-434b-8aa1-c44d4b2d26f6" alt=""><figcaption></figcaption></figure>
{% endtab %}
{% endtabs %}

</details>

<details>

<summary>Key Vault へのネットワーク アクセスを許可する</summary>

Key Vault で [プライベート エンドポイント](https://docs.scepman.com/ja/azure-gou-cheng/private-endpoints.md)を使用している場合は、以下の手順で使用するワークステーションまたは Cloud Shell 環境からのアクセスを許可します。このアクセスがないと、モジュールで CSR を作成したり、証明書をマージしたりできません。

Key Vault で、 **設定** → **ネットワーク**を開き、該当する仮想ネットワークまたはクライアント IP アドレスを許可します。VNet に接続された [Azure Cloud Shell](https://learn.microsoft.com/en-us/azure/cloud-shell/vnet/overview) もサポートされています。証明書のマージ後は、一時的なネットワーク例外を削除してください。

</details>

### 中間 CA を作成する

{% stepper %}
{% step %}

#### SCEPman の証明書設定を構成する

SCEPman App Service で、 **環境変数**を開きます。 **アプリケーション設定**で、次の設定を更新します。

* `AppConfig:KeyVaultConfig:RootCertificateConfig:CertificateName`：Key Vault の証明書名。英字、数字、ハイフンのみを使用してください。
* `AppConfig:KeyVaultConfig:RootCertificateConfig:Subject`：次の値のみを変更します。 `CN` 同じ共通名にします。

選択 **適用** 変更を確定します。 **再起動** App Service を再起動します。その後、SCEPman の URL を開きます。

<figure><img src="https://114237723-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LoGejQeUQcw7lqnQ3WX%2Fuploads%2FvO2YgKtltBesm2Eme7ix%2Fimage.png?alt=media&amp;token=9ec3f21e-b6eb-47c5-8e10-3e2cbe519669" alt="SCEPman App Service certificate settings"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### 証明書要求を作成する

バージョン 1.9 以降の SCEPman PowerShell モジュールを使用します。 [Azure Cloud Shell](https://learn.microsoft.com/en-us/azure/cloud-shell/overview) には Azure CLI が含まれているため、使用をお勧めします。それ以外の場合は、 [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli).

```powershell
Install-Module -Name SCEPman -Scope CurrentUser -Force
```

組織を設定します。

```powershell
Reset-IntermediateCaPolicy -Organization "My Organization"
```

サブジェクトを App Service で構成した値に設定します。保存する前に、追加のポリシー設定を調整することもできます。

{% code lineNumbers="true" %}

```powershell
$policy = Get-IntermediateCaPolicy
$policy.policy.x509_props.subject = "CN=YOUR_CN_FROM_ABOVE,OU=YOUR_TENANT_ID,O=YOUR_ORGANIZATION"
# change some additional settings of $policy
Set-IntermediateCaPolicy -Policy $policy
```

{% endcode %}

CSR を作成します。

```powershell
New-IntermediateCA -SCEPmanAppServiceName "app-scepman-example" -SearchAllSubscriptions 6>&1
```

このコマンドは、ルート CA 用の CSR を出力します。
{% endstep %}

{% step %}

#### 中間 CA 証明書を発行する

ルート CA から発行済みの証明書を取得します。Base64 エンコードされた `.cer` ファイルとして保存します。

<details>

<summary>SCEPman ルート CA: Certificate Master から CSR を送信する</summary>

開く [証明書署名要求 (CSR)](https://docs.scepman.com/ja/zheng-ming-shu-guan-li/certificate-master/certificate-signing-request-csr.md). PEM エンコードされた CSR を貼り付けるか、CSR ファイルをアップロードして、中間 CA 証明書を発行します。証明書をダウンロードする前に、 **ダウンロードするファイル形式** を **PEM** に変更します。

</details>

<details>

<summary>ADCS エンタープライズ ルート CA: Key Encipherment を追加する</summary>

これは、AD と統合された ADCS エンタープライズ ルート CA にのみ適用されます。証明書には次の拡張キー使用法を含める必要があります。 `CRLSign`, `DigitalSignature`, `KeyEncipherment`および `KeyCertSign`。既定の **下位証明機関** テンプレートには `KeyEncipherment`が含まれていません。スタンドアロンおよびオフラインのルート CA では、CSR のキー使用法が使用されます。

1. SubCA 証明書を要求して発行します。SubCA テンプレートを複製できます。
2. ルート CA で、証明書を Base-64 エンコード X.509 形式でエクスポートします。例: `C:\temp\SubCA.cer`.
3. 作成 `C:\temp\extfile.txt`:

```
[Extensions]
2.5.29.15=AwIBpg==
Critical=2.5.29.15
```

4. 実行します：

```powershell
certutil -sign "C:\temp\SubCA.cer" "C:\temp\SubCAwithKeyEncipher.cer" @C:\temp\extfile.txt
```

出力証明書のキー使用法は `0xA6`です。署名は変更されますが、シリアル番号は変更されません。元の ADCS 証明書を失効させると、再署名された証明書も失効します。必要に応じて、 `certutil -deleterow` で古いエントリを削除し、 `certutil -importcert`.

</details>
{% endstep %}

{% step %}

#### 署名済み証明書を結合する

Azure Key Vault で証明書を開き、 **証明書操作** → **署名済み要求の結合**を選択します。発行された証明書をアップロードします。結合に成功すると、証明書は **完了** の下に表示されます。

![Azure Key Vault の証明書操作オプション](https://114237723-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LoGejQeUQcw7lqnQ3WX%2Fuploads%2Fgit-blob-9b845d790796a34cb0e9296434373a502ddfee92%2Fscreenshot-2020-10-19-at-16.01.18%20\(1\)%20\(2\)%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(3\).png?alt=media)

{% hint style="warning" %}
証明書は PEM または Base64 エンコードである必要があります。バイナリ DER エンコードを使用すると、 `x5c has invalid value` エラーが発生します。
{% endhint %}
{% endstep %}

{% step %}

#### CA を確認する

SCEPman のステータスページを開きます。 **CA の適合性** に不足している要件がないことを確認します。MDM を通じて展開するため、中間 CA 証明書をダウンロードします。

SCEPman に `Key Encipherment` が不足していると表示された場合は、発行済み証明書を修正し、もう一度結合します。
{% endstep %}
{% endstepper %}

### Intune の SCEP プロファイル

* **Android：** ルート CA を参照します。
* **Windows：** 中間 CA を参照します。
* **iOS および macOS：** 確かな推奨事項はありません。


---

# 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://docs.scepman.com/ja/scepman-no/intermediate-certificate.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.
