> For the complete documentation index, see [llms.txt](https://docs.realmjoin.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.realmjoin.com/fr/dev-reference/simulating-a-runbook-environment.md).

# Simulation d'un environnement de runbook

## Aperçu

### Créer une inscription d’application

Nous créons une inscription d’application Azure pour simuler la connexion de type application à Microsoft Entra.

<figure><img src="/files/c346e1598776975cd3e6a5745e84def4d51aee0c" alt=""><figcaption><p>Créer une inscription d’application</p></figcaption></figure>

### Accorder des autorisations

Nous accorderons les mêmes autorisations que celles qu’aurait l’identité managée. Nous utiliserons le même [AppRoleGranter Toolkit](https://github.com/hcoberdalhoff/approle-and-directoryrole-granter) à cette fin.

Remplacez `{AppRegObjectId}` avec l’ID d’objet de votre inscription d’application.

```powershell
git clone https://github.com/hcoberdalhoff/approle-and-directoryrole-granter.git
cd "approle-and-directoryrole-granter\RealmJoinVnext"
. .\AllInOne.ps1 -appRegObjectId "{AppRegObjectId}"
```

### Créer et téléverser un certificat de développement

Voir [ici ](https://github.com/realmjoin/RealmJoin.RunbookHelper/blob/main/DevCertificates.ps1)pour un exemple de création d’un certificat de développement RunbookHelper. Remplacez `{Variables}` en conséquence.

Le `{AppID}` fait référence à l’ID d’application / client de l’inscription d’application.

Si vous n’avez pas d’ID d’abonnement spécifique, utilisez simplement un abonnement par défaut de votre Tenant. (Cela n’a pas d’importance dans la plupart des cas.)

```powershell
New-SelfSignedCertificate -Subject 'CN=AzureRunAsConnection, OU={AppID}, DC={TenantID}, O={SubscriptionID}' `
    -CertStoreLocation "cert:\CurrentUser\My" -NotAfter (Get-Date).AddYears(10) -KeySpec Signature | `
    Export-Certificate -FilePath "AzureRunAsConnection.cer"
```

Vous obtiendrez un fichier `AzureRunAsConnection.cer` que vous téléversez dans les secrets de l’inscription d’application.

{% hint style="info" %}
Si vous souhaitez prendre en charge plusieurs applications / environnements, vous pouvez remplacer le « AzureRunAsConnection » par défaut dans`CN=AzureRunAsConnection` par un nom personnalisé lors de la création du certificat pour cet environnement.

Vous pouvez ensuite sélectionner l’environnement/le certificat (par ex. « OtherEnv ») pour vous connecter au moyen de `Connect-RjRbGraph -AutomationConnectionName "OtherEnv"`

Ainsi, vous pouvez accéder à plusieurs environnements depuis la même machine.
{% endhint %}

<figure><img src="/files/a7f52278a7c8a18cafe76a50c115425ea13d08c6" alt=""><figcaption><p>Téléversement du certificat</p></figcaption></figure>

### Utilisation

Utilisez simplement `Connect-RjRbGraph` pour vous authentifier auprès de l’application.

Assurez-vous de supprimer les anciens certificats de développement à l’aide de mmc.exe de votre ensemble de certificats personnels, s’ils sont présents, afin d’éviter les conflits/échecs de connexion.


---

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

```
GET https://docs.realmjoin.com/fr/dev-reference/simulating-a-runbook-environment.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
