skip to content

In RD Gateway, what do RD CAP and RD RAP each decide, and in which order does a connection meet them?

level: middleimportance: must knowfreq 34%

answer

  1. two policies, one after the other
  2. first: may you come in
  3. second: where may you go
  4. denial codes tell which one fired

basics

~20 s

A connection meets RD CAP first, which decides whether the user may connect through the gateway at all (user and device groups, authentication method). RD RAP then decides which internal target hosts that user may reach.

solid answer

~40 s

The gateway checks two policies in a fixed order. **RD CAP** (Connection Authorization Policy) is checked first when the tunnel is created: in the Windows implementation it weighs the user's group membership, optionally the client computer's group, the authentication method (password or smart card) and, optionally, client health. **RD RAP** (Resource Authorization Policy) is checked when the client asks for a channel to a named target server, and decides which hosts that user may reach. A refused target returns `E_PROXY_RAP_ACCESSDENIED` (0x800759DA). Keep the default policies from becoming the real policy: write CAPs per population and RAPs per host set, so a contractor passes the first check yet reaches only their own servers. Both are decisions at connection setup, and MFA, where used, is added at the authentication step through RADIUS.

go deeper

for a junior

Recall that one policy lets you in through the gateway and the other limits which internal hosts you may reach.

for a middle

State the order, CAP on tunnel creation then RAP on channel creation, list what CAP weighs, and tell the two denial codes apart.

for a senior

Design CAPs per population and RAPs per host set, place MFA through RADIUS, and diagnose which stage refused a given user.

for a principal

Decide who owns the groups the policies depend on and how access to those groups is reviewed over time.

## Two questions asked in a fixed order RD Gateway does not hand a connected user the whole network. Microsoft's access-from-anywhere page names **RD Connection Authorization Policies (RD CAPs)** and **RD Resource Authorization Policies (RD RAPs)** as the tools for defining which users reach which resources, but it is loose about which policy answers which question. The specification, **MS-TSGU**, is exact about order, so use it. 1. The client connects, authenticates and creates a **tunnel**. In the specification's description of the HTTP transport, the client has passed the **CAP** checks at the end of that step. 2. The client authorizes the tunnel, then asks for a **channel** to a named target server. The same description says the client has passed the **RAP** checks at the end of that step and is connected to the target. So the order is CAP, then RAP, and both must pass before any RDP data flows. ## What RD CAP evaluates The specification's note on the Windows implementation lists the conditions, all set in CAPs: - the user's group membership; - the client computer's group membership (optional); - the authentication method, password or smart card; - the client computer's health status (optional). The same note says Windows Server 2016 and Windows Server 2019 do not perform the health-check calls, so do not rely on health as a CAP condition there. A CAP answers "may this user, from this kind of client, with this credential, come in at all". ## What RD RAP evaluates At channel creation the gateway initializes its list of target server names from the request and **authorizes the resource per the policies configured at the gateway**. A RAP answers "which internal hosts may this user reach". If the target is not authorized, the gateway returns `E_PROXY_RAP_ACCESSDENIED`. ## Reading a denial | Return code | Value | The specification says | |---|---|---| | `E_PROXY_NAP_ACCESSDENIED` | 0x800759DB | the gateway denies the client access due to policy; the client ends the protocol | | `E_PROXY_RAP_ACCESSDENIED` | 0x800759DA | an attempt to resolve or access a target server is blocked by gateway policies | | `E_PROXY_TS_CONNECTFAILED` | 0x000059DD | the gateway failed to connect to the target server | The third row matters for triage: a host that is simply off or unreachable from the gateway produces a different failure than a policy refusal. A signal like this tells you which stage refused; it cannot tell you whether the policy itself is the right one. For evidence, export the policies and attach the group owners, because an auditor will ask who maintains the membership, not only what the policy says. ## A worked reading A contractor, `[email protected]`, connects to `rdg.example.com`. 1. The user belongs to a contractors group that a CAP names and signs in with a smart card, which that CAP requires. The tunnel is created and the CAP check is passed. 2. The client asks for a channel to `host1.example.net`, which the contractors' RAP lists. The channel is created and the user reaches the host. 3. The client then asks for `host9.example.net`, which the RAP does not list. The gateway returns `E_PROXY_RAP_ACCESSDENIED` and the user sees a refusal, although the gateway accepted them a moment earlier. ## Where multi-factor authentication sits The planning pages describe MFA as part of authentication at the gateway: the gateway can use the RADIUS protocol to reach a Network Policy Server, whose extension bridges to a cloud MFA service, and the user receives a mobile-app challenge on connecting to the gateway. Plan user enrollment, backup authentication for lost devices, any location- or device-based conditions, and firewall rules to the MFA service endpoints. The documented benefit is that a compromised password alone no longer opens a connection. ## Policy design that survives an audit - Replace the default policies with CAPs per population (staff, contractors, administrators) so authentication method requirements differ. - Write RAPs per host set; a contractor's group should list only that contractor's session hosts. - When a Connection Broker places users on any host of a collection, the RAP must cover every host the broker may choose, or some users will intermittently be refused. - Review membership of the groups the policies name, because the policies are only as current as those groups. These policies decide at connection setup. They are not a per-request decision engine; that belongs to the material on zero trust.

  • A contractor reaches the gateway but is refused on one host with 0x800759DA; where do you look?
    That code means a target server was blocked by gateway policy at channel creation, so the connection already passed the first check. Inspect the RAP for that host and the groups it names. A different failure, 0x000059DD, would point at the gateway being unable to reach the host.
  • Does the gateway's MFA replace the target host's own sign-in?
    No. MFA is a second factor at the gateway; the host still authenticates the user. The .rdp setting promptcredentialonce (default 1, per the Learn page) controls whether the credentials entered are reused for both the gateway and the remote computer, so users are not asked twice.
  • Why can a RAP that lists only two hosts break a farm behind a Connection Broker?
    The broker may place a new session on any host of the collection. A RAP naming only two of four hosts refuses the connection whenever the broker picks another one, which looks like an intermittent fault. List every host of the collection or use a group that tracks them.

Think of a building: the front desk checks your badge and your group before letting you into the lobby (the first policy), and a second list on the lift decides which floors you may visit (the second policy).

  • Says RD RAP is checked first and RD CAP afterwards.
  • Thinks the two policies are one rule that decides in a single step.
  • Assumes CAP decides which hosts a user can reach.
  • Treats a client's health check as dependable on every Windows Server release.
  • Expects MFA at the gateway to replace the host's own sign-in.