# On-Premises Kerberos Bridge via Entra Application Proxy

- Status: Accepted
- Deciders: Emmitt Johnson, Brian Sheridan, Jason Yue, Taylor Lewing, Mark Edwards, Nicolas Marks, Brian Dugan
- Date: 2026-09-30

## Context and Problem Statement

System Connectors ([epic #1049](https://github.com/saif-corp/forge/issues/1049)) front
on-premises IIS APIs for callers that already have a Forge identity. Most of those APIs accept only
Windows authentication. Forge workloads can't provide it: the connector API is a Linux container
that isn't domain-joined, and the callers use OAuth. Today the fallback is NTLM, and on-premises
there are no service principal names (SPNs) that would let Kerberos work instead.

Two things are called "connector" in this ADR:

- **Connector API**: the System Connector, a Forge API that runs as a Linux container on App
  Service.
- **Application Proxy connector VM**: Microsoft's agent, installed on domain-joined Windows
  servers on-premises. It gets the Kerberos ticket on the connector API's behalf.

Entra Application Proxy can turn an Entra token into a Kerberos ticket through Kerberos Constrained
Delegation (KCD). However, KCD needs a token that carries a user principal name. Application-only
tokens (managed identity or client credentials) don't have one, so the connector API has to sign in
*as* a user that is synced from Active Directory.

The spike ([#1051](https://github.com/saif-corp/forge/issues/1051),
[#1055](https://github.com/saif-corp/forge/issues/1055)) proved the full chain works without user
interaction:

1. The connector API uses Resource Owner Password Credentials (ROPC) to get a token as the synced
   account.
2. The Application Proxy connector VM performs resource-based KCD.
3. IIS sees a Kerberos identity.

This leaves several questions to decide: which accounts to use, how their credential is held and
rotated, and how Conditional Access (CA) lets a password-only sign-in through without weakening
the tenant. These were agreed at the security review on 2026-09-30.

## Decision Drivers

- No NTLM on any caller-to-API path that goes through a connector API.
- Connector APIs run as Linux containers and can't join the domain.
- Onboarding a new on-premises API must not need an edit to a tenant-wide CA rule.
- No human should know, or be able to retrieve, the password of the synced AD user account that the
  connector API impersonates to get an Entra token, which Application Proxy exchanges for a Kerberos
  ticket.
- Rotating the credential must not become a routine source of outages.

## Considered Options

- **Application Proxy + KCD, ROPC as shared synced accounts** (chosen)
- Application Proxy + KCD with one account per API or per connector API
- A group Managed Service Account (gMSA) as the delegated identity
- A self-hosted, domain-joined Windows gateway that holds Kerberos credentials
- Keep NTLM

## Decision Outcome

Chosen option: **"Application Proxy + KCD, ROPC as shared synced accounts"**. Application Proxy + KCD
removes NTLM without running Windows infrastructure in Forge, and Security accepted its
compensating controls. Shared tier accounts were chosen over per-API or per-connector accounts to
keep the number of passwords, vault entries and assignments small; the accepted cost is that one
account's compromise reaches every on-premises API in its tier.

### Mechanism

- Each on-premises API is published as its own Application Proxy enterprise app. Each app has
  Entra pre-authentication and uses Integrated Windows Authentication single sign-on.
- Each API gets a structured SPN, `HTTP/{env}.saif.com/{app-name}`, registered on that API's own
  app pool account. The Application Proxy connector VMs get resource-based delegation to that
  account.
  Host SPNs such as `HTTP/api.saif.com` are never registered.
- An app pool that runs as Local System uses the host's machine account. That gives every API on
  the host one shared account, and in production one site spans six load-balanced hosts while an
  SPN can sit on only one account. Such pools move to a domain account or gMSA first.
- The delegation boundary is the app pool account, not the SPN. Each API must run in its own app pool
  under its own account, including in production. The estate does not guarantee that today (#1055 found shared identities, including the `iispool2` cluster), so uniqueness is an onboarding requirement that is verified and remediated first. With it, the chain is one-to-one: one tagged
  enterprise app → one unique SPN → one app pool account. A ticket for one API can't be used
  against another, even when APIs share an IIS host. Onboarding confirms the account isn't shared.
- The connector API's `EntraDelegated` dialect gets a token for the enterprise app through ROPC.
  Backend identity is pass-through: IIS sees the service account. Connector API telemetry records
  the calling experience API; the original caller is in that experience API's telemetry.

### Accounts

- There are **two** synced Active Directory service accounts: one for all non-production
  environments and one for production. Every connector API in a tier shares its tier's account.
- There are no per-API or per-backend exceptions. A backend too sensitive or too broadly
  permissioned for the shared account is ineligible for this pattern.
- Each enterprise app's user and group assignment is limited to its tier's account, and
  **Assignment required?** is set to **Yes** so the assignment is an enforced access boundary.
- The accounts can't sign in to on-premises machines. This is tracked in
  [#1257](https://github.com/saif-corp/forge/issues/1257).
- The accounts can't be gMSAs. A gMSA has no password to retrieve, so it can't perform ROPC, and it
  isn't synced as an Entra user.

### Conditional Access

- **Connector tag.** Each Application Proxy enterprise app that a connector API calls through
  `EntraDelegated` is tagged with a custom security attribute. Information Security and Client &
  Cloud Solutions (C&CS) own the attribute's definition, name, and values; this ADR records only
  that the tag exists and what it means. The tag names the trust decision, not the infrastructure,
  so human-facing Application Proxy apps are never tagged. Onboarding automation assigns the tag
  and holds the role needed to assign it, scoped to the tag's definition.
- **Location.** The accounts are excluded from `CA016`. A dedicated policy blocks them outside a
  named location holding the four Azure egress IPs (hub SNAT). This means connector APIs must route
  all outbound traffic through the VNet (`vnetRouteAllEnabled`).
- **Tagged apps only.** The accounts must reach only tagged apps, and MFA and compliant-device rules
  must not block them there. Conditional Access identifies those apps with an application filter
  on the connector tag, so no policy names an individual app. Identity owns how the policies are
  structured and is choosing between the options recorded in
  [#1257](https://github.com/saif-corp/forge/issues/1257); this ADR doesn't fix that choice.

The rollout (report-only first, then enforced) is tracked in
[#1257](https://github.com/saif-corp/forge/issues/1257).

### Credential handling

- The password is 64 random characters with no leading or trailing whitespace. It's generated and
  set in one step and never shown, copied, or stored in Keeper.
- It's stored in a **dedicated Key Vault per tier** (non-prod and prod). Network Security writes
  it by activating a Privileged Identity Management (PIM) group that has write-only access. Each
  connector API reads it as its app-registration service principal, which needs Key Vault Secrets
  User on its own tier's vault only, so a non-prod connector can't read the prod password.
- **Rotation exemption.** The password isn't rotated on a schedule. It's rotated only after an
  event, such as suspected exposure, a Security request, or a change to who can write the vault.
  The rotation follows the service account rotation runbook (see
  [#1049](https://github.com/saif-corp/forge/issues/1049)),
  which must be tested before go-live. The exemption still needs a formal audit record, tracked in
  [#1257](https://github.com/saif-corp/forge/issues/1257).
- Self-service password reset isn't an option, because the accounts have no MFA method registered.

### Consequences

- Good, because Kerberos replaces NTLM on connector API paths, with a unique SPN, app pool account
  and delegation grant per API even when APIs share an IIS host.
- Good, because onboarding an API adds a tag instead of editing a CA rule. The per-API human steps
  (SPN and delegation request, admin consent, Application Proxy app creation and assignment) are
  unchanged.
- Good, because no person holds the password, and only a PIM-activated Network Security group can
  write it.
- Bad, because ROPC is discouraged by Microsoft and is being restricted over time. Review this
  decision if Microsoft deprecates ROPC for synced users, or if Entra Kerberos or cloud sync offers
  an app-only path.
- Bad, because a password that isn't rotated depends on the Key Vault and PIM controls holding. A
  rotation, when it does happen, briefly fails token refreshes during password hash sync, and
  repeated failures risk locking out the shared account.
- Bad, because the named location holds shared Azure egress IPs, so it narrows where the accounts can sign in but doesn't confine a stolen credential to connector workloads. The tag and assignment are the primary controls.
- Bad, because on-premises APIs become reachable from the internet through `*.msappproxy.net`,
  protected by Entra pre-authentication and the controls above.
- Neutral, because Kerberos fails when clocks drift between the Application Proxy connector VMs, the
  domain controllers, and the IIS hosts. This adds a time-sync dependency that NTLM didn't have.

<!-- Links -->

- [System Connectors epic #1049](https://github.com/saif-corp/forge/issues/1049)
- [ADR 0009 — On-Premise Authentication to Forge](0009-on-premise-authentication-to-forge.md)
- [Microsoft: Kerberos Constrained Delegation for SSO with Application Proxy](https://learn.microsoft.com/en-us/entra/identity/app-proxy/how-to-configure-sso-with-kcd)
- [Microsoft: Custom security attributes](https://learn.microsoft.com/en-us/entra/fundamentals/custom-security-attributes-overview)
- [Microsoft: Conditional Access filter for applications](https://learn.microsoft.com/en-us/entra/identity/conditional-access/concept-filter-for-applications)
- [Microsoft: OAuth 2.0 Resource Owner Password Credentials](https://learn.microsoft.com/en-us/entra/identity-platform/v2-oauth-ropc)
