> 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/fr/gestion-des-certificats/api-certificates/api-enrollment.md).

# Inscription via l'API

Utilisez cette API REST en utilisant les identités Microsoft pour l'authentification afin d'inscrire des certificats, en alternative aux points de terminaison SCEP qui nécessitent le style d'authentification SCEP.

{% hint style="info" %}
Cette fonctionnalité nécessite la version **2.3.689** ou supérieure.
{% endhint %}

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

SCEPman propose une API REST pour inscrire des certificats. Il s'agit d'une alternative aux points de terminaison SCEP qui nécessitent l'authentification de type SCEP, tandis que l'API REST utilise Microsoft Identities pour l'authentification. Le protocole est également beaucoup plus simple que SCEP.

## Prérequis

### 1. Service Principal

{% stepper %}
{% step %}

### Inscription d'application

Créez un nouveau *Inscription d'application* qui décrit votre cas d'utilisation. Votre application s'authentifiera en tant que cette application auprès de SCEPman.
{% endstep %}

{% step %}

### Autorisations API

#### CSR.Request.Db

Attribuez les autorisations requises en exécutant le **Register-SCEPmanApiClient** cmdlet du module PowerShell SCEPman.

Exemple :

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

*ServicePrincipalId*

Le ***ID d'objet*** de l'Application d'entreprise complémentaire ***Application d'entreprise*** de l'inscription d'application que nous avons créée à l'étape précédente. Notez que cela ne fait pas référence à l'Application d'entreprise généralement nommée SCEPman-api, qui identifie SCEPman lui-même.

Pour attribuer manuellement cette autorisation, vous pouvez naviguer vers *Autorisations API* et ajouter une autorisation à partir des *autorisations utilisées par votre organisation*. Attribuez le ***CSR.Request.Db*** autorisation de ***SCEPman-api*** en tant qu' *autorisation d'application*.

#### Application.Read.All (facultatif)

*Service Principals* nécessitera également l'autorisation Graph ***Application.Read.All*** pour permettre la récupération automatique du périmètre d'API de SCEPman pour l'authentification.

L'autorisation peut être ajoutée manuellement comme suit :

<figure><img src="https://129332256-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 %}

### Secret client

Créez un secret client dans « Certificats et secrets ». Le secret client sera utilisé comme mot de passe pour authentifier l'application ultérieurement.
{% endstep %}
{% endstepper %}

### 2. Paramètres d'App Service

#### Configuration

*Requis pour le renouvellement du certificat*

Configurez votre App Service SCEPman pour accepter les certificats clients mTLS. Dans le volet Configuration de la section Paramètres, vérifiez que le mode Certificat client dans Certificats clients entrants est défini sur ***Utilisateur interactif facultatif***.

<figure><img src="https://129332256-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>

Ne définissez pas le mode Certificat client sur Exiger ou Autoriser, car cela perturberait le fonctionnement normal de SCEPman sur les points de terminaison SCEP !

#### Variables d’environnement

Pour pouvoir utiliser ce scénario, vous devez définir les variables d’environnement suivantes sur l’App Service SCEPman.

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

*Requis pour l’inscription et le renouvellement des certificats*

Définissez cette variable sur ***true*** pour activer la validation des demandes de signature de certificat (CSR).

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

*Requis pour le renouvellement du certificat*

Définissez cette variable sur ***true*** pour activer le renouvellement des certificats.

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

*Requis pour le renouvellement du certificat*

Définissez cette variable sur une liste de types de certificats séparés par des virgules pour lesquels vous souhaitez autoriser le renouvellement. Consultez la documentation liée de la variable pour une liste des types de certificats possibles.

Exemple : ***Static,IntuneUser,IntuneDevice***

## Inscription des certificats

Après avoir préparé les prérequis, vous pouvez envoyer un POST PKCS#10/CMS à votre SCEPman avec le chemin HTTP *api/csr*. La réponse HTTP sera le certificat tout juste émis, encodé en DER.

SCEPman stockera automatiquement tous les certificats émis dans son Storage Account, afin que vous puissiez facilement les lister et les révoquer via le composant Certificate Master.

Une méthode pratique pour envoyer ces requêtes est notre module PowerShell SCEPmanClient :

{% content-ref url="/pages/e13dc3c6efc569a4b2dd87e2c564bb136d77c73e" %}
[SCEPmanClient](/fr/gestion-des-certificats/api-certificates/scepmanclient.md)
{% endcontent-ref %}

## Autres exemples

Voir notre [Bibliothèque d'exemples open source sur GitHub](https://github.com/scepman/csr-request) pour découvrir comment utiliser l'API REST de SCEPman.


---

# 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/fr/gestion-des-certificats/api-certificates/api-enrollment.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.
