> 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/es/dev-reference/simulating-a-runbook-environment.md).

# Simulación de un entorno de runbook

## Descripción general

### Crear un registro de aplicación

Creamos un registro de aplicación de Azure para simular el inicio de sesión de tipo aplicación en Microsoft Entra.

<figure><img src="/files/97e2545762ad3f57fca33288e1c7158d6af4e0f4" alt=""><figcaption><p>Crear un registro de aplicación</p></figcaption></figure>

### Conceder permisos

Concederemos los mismos permisos que tendría la identidad administrada. Usaremos el mismo [AppRoleGranter Toolkit](https://github.com/hcoberdalhoff/approle-and-directoryrole-granter) para este propósito.

Reemplaza `{AppRegObjectId}` con el ID de objeto de tu registro de aplicación.

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

### Crear y cargar un certificado de desarrollo

Vea [aquí ](https://github.com/realmjoin/RealmJoin.RunbookHelper/blob/main/DevCertificates.ps1)para un ejemplo de cómo crear un certificado de desarrollo de RunbookHelper. Reemplaza `{Variables}` en consecuencia.

La `{AppID}` se refiere al App / Client ID de Application Regsitrations.

Si no tienes un ID de suscripción específico, usa simplemente una suscripción predeterminada de tu Tenant. (En la mayoría de los casos no importa.)

```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"
```

Obtendrás un archivo `AzureRunAsConnection.cer` que subes a los secretos del registro de la aplicación.

{% hint style="info" %}
Si quieres servir a varias aplicaciones / entornos, puedes reemplazar el "AzureRunAsConnection" predeterminado en`CN=AzureRunAsConnection` por un nombre personalizado al crear el certificado para ese entorno.

Luego puedes seleccionar qué entorno/certificado (p. ej., "OtherEnv") usar para conectarte mediante `Connect-RjRbGraph -AutomationConnectionName "OtherEnv"`

De este modo puedes acceder a varios entornos desde la misma máquina.
{% endhint %}

<figure><img src="/files/09fbc63ddb69fe0c19e89e3b35edc2ad98116bdb" alt=""><figcaption><p>Carga del certificado</p></figcaption></figure>

### Uso

Usa simplemente `Connect-RjRbGraph` para autenticarte en la aplicación.

Asegúrate de quitar los certificados de desarrollo antiguos usando mmc.exe de tu conjunto de certificados personales, si los hay, para evitar conflictos/fallos de inicio de sesión.


---

# 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/es/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.
