> For the complete documentation index, see [llms.txt](https://docs.p0.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.p0.dev/integrations/resource-integrations/rdp/requesting-access.md).

# Requesting RDP access

How to request a just-in-time RDP session to a Windows virtual machine in Azure, and connect to it, through P0

Request a just-in-time Remote Desktop session to a Windows VM in Azure through P0. When your request is approved, you can sign in to the VM through your organization's Azure Bastion host with your Microsoft Entra ID account. When access ends, P0 disconnects the Bastion sessions to the VM.

## Connect with the P0 CLI

To use `p0 rdp`, you need:

* A Windows computer. On macOS or Linux, `p0 rdp` stops with `RDP session connections are only supported on Windows.`
* The P0 CLI. See [Windows](https://docs.p0.dev/p0-cli/installing-p0-cli/windows.md).
* The [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli). If you aren't signed in, `p0 rdp` signs you in to your organization's Azure tenant.

`p0 rdp` requests access, waits for approval, and opens the Remote Desktop session:

```bash
p0 rdp <destination> [--reason <reason>] [--admin] [--configure]
```

| Argument            | Description                                                                                                                                                                                                                                                    |
| ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `<destination>`     | The VM's name or its Azure resource ID.                                                                                                                                                                                                                        |
| `--reason <reason>` | Why you need access. Approvers see it.                                                                                                                                                                                                                         |
| `--admin`           | Request admin access. P0 gives you the **Virtual Machine Administrator Login** role on the VM, and `p0 rdp` connects with the VM's local administrator account instead of your Microsoft Entra ID account. Remote Desktop asks for that account's credentials. |
| `--configure`       | Open Remote Desktop's settings before connecting.                                                                                                                                                                                                              |

For example:

```bash
p0 rdp win-build-01 --reason "Debug the nightly build"
```

If you already have access to the VM, `p0 rdp` connects without a new request.

## Request without connecting

To request access without opening a session, from any computer:

```bash
p0 request rdp session <destination> [--admin] [--reason <reason>]
```

With `--admin`, P0 also gives you the **Virtual Machine Administrator Login** role on the VM. To connect as the VM's local administrator, use `p0 rdp <destination> --admin`.

In Slack, the same command works as a slash command, such as `/p0 request rdp session <destination>`. To fill in a form instead, type `/p0 request` in Slack, or click **Request Access** on the **Access Management** page of the P0 app. Select **Remote Desktop Protocol (RDP)**, then **RDP session**, and choose the **Destination**. Select **Admin** for admin access.

Once you have access, connect with `p0 rdp <destination>` from a Windows computer.

For every way to request access, see [Requesting access](https://docs.p0.dev/access-management/access-management/just-in-time-access/requesting-access.md).

## Troubleshooting

| Message                                                                                         | What to do                                                                                                                                                                             |
| ----------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `This organization is not configured for RDP access`                                            | Your organization hasn't installed RDP. Ask your P0 admin.                                                                                                                             |
| `Azure instance '<destination>' not found`                                                      | Check the VM's name. If it's right, the VM may be missing the `AADLoginForWindows` extension. Ask your P0 admin.                                                                       |
| `User <email> does not exist in any of your directories`                                        | Your P0 email doesn't match a user in your organization's Microsoft Entra ID. Ask your P0 admin.                                                                                       |
| A message that starts `Azure Bastion rejected the RDP request with "Unexpected internal error"` | Try again in a few minutes. If it keeps failing, try `--admin` to connect with the VM's local administrator account, or ask your Azure admin to check the VM's Entra ID sign-in setup. |
