> 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 les autorisations

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

Remplacez `{AppRegObjectId}` par 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 montrant comment créer un certificat de développement RunbookHelper. Remplacez `{Variables}` en conséquence.

Les `{AppID}` fait référence à l’ID d’application / client des inscriptions 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 servir 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 choisir quel environnement/certificat (par ex. "OtherEnv") utiliser pour vous connecter à l’aide de `Connect-RjRbGraph -AutomationConnectionName "OtherEnv"`

De cette façon, 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 magasin 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, and the optional `goal` query parameter:

```
GET https://docs.realmjoin.com/fr/dev-reference/simulating-a-runbook-environment.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.
