> 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/p0-cli/p0-commands-and-usage/p0-rdp.md).

# p0 rdp

### **Overview** <a href="#overview" id="overview"></a>

The `p0 rdp` command connects you to a Windows virtual machine via Remote Desktop Protocol (RDP) through Azure Bastion Host. It **automatically requests and provisions RDP access** via P0, then launches the Bastion RDP session with Entra ID (Azure AD) authentication.

1. **Authentication** against P0 and Azure
2. **Access request** against your RDP integration
3. **Provisioning** of time-limited RDP access
4. **Connection** through Azure Bastion Host

Use `p0 rdp` anytime you need to access a Windows VM—no need to manage credentials, open tickets, or configure Bastion manually.

{% hint style="info" %}
`p0 rdp` is currently supported on **Windows only**. Entra ID authentication for RDP through Azure Bastion requires a Windows client machine.
{% endhint %}

***

### **Prerequisites** <a href="#prerequisites" id="prerequisites"></a>

* **Windows operating system** — the command exits with an error on other platforms.
* **Logged-in user**

```plaintext
p0 login <org-slug>
```

* **Azure CLI (`az`) installed** — the command shells out to `az network bastion rdp`.
* **RDP integration configured and installed** in your P0 tenant.
* **Azure Bastion Host configured** for the target VM in your Azure environment.
* **Valid Azure credentials** — the CLI performs `az login` if you are not already authenticated.

***

### **Syntax** <a href="#syntax" id="syntax"></a>

```plaintext
p0 rdp <destination> [options]
```

***

### **Positional arguments** <a href="#positional-arguments" id="positional-arguments"></a>

| Argument    | Type   | Required | Description                                                      |
| ----------- | ------ | -------- | ---------------------------------------------------------------- |
| destination | string | Yes      | The name or identifier of the Windows VM you want to connect to. |

***

### **Options** <a href="#options" id="options"></a>

| Flag              | Type    | Default | Description                                            |
| ----------------- | ------- | ------- | ------------------------------------------------------ |
| `--reason <text>` | string  | —       | Justification for the access request (for audit logs). |
| `--configure`     | boolean | `false` | Configure the RDP session settings before connecting.  |
| `--debug`         | boolean | `false` | Print debug information during the connection process. |

***

### **How it works** <a href="#how-it-works" id="how-it-works"></a>

1. **Verify platform**: confirms you are running on Windows. Exits with an error on other operating systems.
2. **Authenticate**: logs you in to P0 via `p0 login` credentials.
3. **Validate integration**: checks that your P0 tenant has an RDP integration installed. Exits if no integration is configured.
4. **Request access**: sends a permission request to the P0 backend for an RDP session to the specified destination. Waits for the request to be approved and provisioned.
5. **Set up Azure**: sets the active Azure CLI subscription and logs in to the correct Azure tenant if needed.
6. **Connect**: launches `az network bastion rdp` with Entra ID authentication (`--auth-type aad`) to establish the RDP session through Azure Bastion Host.

***

### **Examples** <a href="#examples" id="examples"></a>

#### **1. Connect to a Windows VM** <a href="#id-1-connect-to-a-windows-vm" id="id-1-connect-to-a-windows-vm"></a>

```plaintext
p0 rdp my-windows-vm --reason "Investigate failing service"
```

* Requests RDP access to `my-windows-vm` with an audit trail reason.
* Waits for approval and provisioning, then opens the RDP session.

***

#### **2. Configure the RDP session before connecting** <a href="#id-2-configure-the-rdp-session-before-connecting" id="id-2-configure-the-rdp-session-before-connecting"></a>

```plaintext
p0 rdp my-windows-vm --configure
```

* Opens the RDP session configuration dialog before connecting, allowing you to adjust display, local resource, and other session settings.

***

#### **3. Debug the connection flow** <a href="#id-3-debug-the-connection-flow" id="id-3-debug-the-connection-flow"></a>

```plaintext
p0 rdp my-windows-vm --debug
```

* Prints detailed information about API calls, Azure authentication, and the Bastion connection process.

***

### **Error conditions** <a href="#error-conditions" id="error-conditions"></a>

* **"RDP session connections are only supported on Windows."**

  You are running the command on macOS or Linux. RDP via Azure Bastion with Entra ID authentication requires a Windows client.
* **"This organization is not configured for RDP access"**

  Your P0 tenant does not have an RDP integration installed. Contact your P0 administrator to configure the integration.
* **"Your access request was denied"**

  An approver denied your RDP access request. Check your request reason and try again, or contact the approver.
* **"Failed to create Azure Bastion RDP connection: \<error details>"**

  The `az network bastion rdp` command failed. Verify that:

  * Azure CLI is installed and up to date.
  * You have network access to the Azure Bastion Host.
  * The target VM is running and reachable from the Bastion.
* **Azure authentication errors**

  If you see errors about subscriptions, tenants, or authorization, verify that:

  * You are logged in to the correct Azure tenant (`az login`).
  * Your Azure account has access to the subscription containing the target VM.
