> ## Documentation Index
> Fetch the complete documentation index at: https://docs.certgov.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Workload Identity

> X.509 certificate-based identities for AI agents, service accounts, and automated workloads — issued by CertGov's platform CA, with built-in policy, approval, lifecycle, and revocation.

AI agents, service accounts, CI runners, and microservices — collectively called **workloads** — are moving into production in regulated environments. API keys and bearer tokens don't give them a verifiable identity, a clear issuance chain, or a revocation path. X.509 certificates do.

CertGov issues and governs those certificates: it runs its own platform-managed intermediate CA (backed by Azure Key Vault) that signs workload certs directly — no external CA required.

## The stack

```
┌─────────────────────────────────────────────────────┐
│  Agent runtime                                       │
│  (LangGraph · Temporal · Dapr · custom)              │
│                                                      │
│  Requests a cert  →  presents cert on each call      │
└────────────────────────┬────────────────────────────┘
                         │  enrollment token (first time)
                         │  mTLS with current cert (renewal)
┌────────────────────────▼────────────────────────────┐
│  CertGov                                             │
│  Policy · approval · lifecycle · compliance          │
│                                                      │
│  "Is this workload allowed to get a cert?"           │
│  "How long should it be valid?"                      │
│  "Does our workload cert policy meet SOC 2 controls?"│
│                                                      │
│  Issues cert via platform intermediate CA (AKV)      │
└─────────────────────────────────────────────────────┘
```

CertGov owns the full stack for workload identity — it both enforces policy and signs the certificate. The signing key lives in Azure Key Vault and never leaves it.

## Why X.509 for agents

| Property | API key | X.509 certificate |
| - | - | - |
| Verifiable issuer | No | Yes — signed by a known CA |
| Expiry | Manual rotation | Enforced by the certificate |
| Revocation | Revoke and redeploy | Certificate revocation via the CA's revocation list (CRL) |
| Scope | Usually global | SAN / key usage constraints |
| Audit trail | Who created the key | Who requested, who approved, which CA issued |

An agent with a certificate has a verifiable identity, a clear issuance chain, and a lifecycle that CertGov can track, alert on, and enforce policy over.

## How CertGov fits

### Short-lived certificates + standing renewal grants

Workload certs should be short-lived — hours to days, not 90 days. CertGov supports sub-24-hour validity periods and **standing renewal grants**: a policy that auto-approves renewal requests for a specific workload or workload class without requiring human review on every rotation.

This is the high-frequency issuance model workload identity requires:

1. Agent starts up and has no cert (or its cert has expired)
2. Agent requests a new cert through CertGov's API or MCP server
3. Standing renewal grant matches — no human approval needed
4. CA issues the cert in seconds
5. Agent presents the cert on all API calls
6. Agent renews before expiry — the loop repeats automatically

Human approval is reserved for the first issuance (or escalation events), not every rotation.

### Domain Trust Profiles as agent policies

A [Domain Trust Profile](https://docs.certgov.app/concepts/domain-trust-profiles.md) (DTP) is the policy object that governs who can request certs, under what conditions, and with what approval flow. For workload identity:

* Create a DTP scoped to your agent namespace (e.g. `*.agents.internal`, `agent.*.yourdomain.com`)
* Set a short validity period (4h, 24h, 7d — whatever your rotation target is)
* Attach a standing renewal grant so approved agents renew without human review
* Require a justification note on first issuance so there's an audit record

### Kubernetes agents via cert-manager

If your agents run in Kubernetes, the [certforge-issuer](https://docs.certgov.app/guides/certforge-issuer.md) external issuer is the integration path. cert-manager handles the rotation mechanics; CertGov enforces policy on every `CertificateRequest`:

```
Agent pod → cert-manager (Certificate CR) → certforge-issuer → CertGov → CA
                                                             ← signed cert ←
```

Your `Certificate` manifest points `issuerRef` at CertGov. cert-manager handles renewal scheduling. CertGov evaluates each request against your DTP policy before forwarding to the CA.

See [cert-manager integration](https://docs.certgov.app/guides/cert-manager.md) and [certforge-issuer](https://docs.certgov.app/guides/certforge-issuer.md) for setup details.

### Workload Identity Providers — keyless authentication

certforge-issuer (and any other workload) can authenticate to CertGov using a **Kubernetes projected ServiceAccount token** instead of a long-lived API key. This is configured through Workload Identity Providers in Settings.

**How it works:**

```
certforge-issuer pod
  │  mounts: /var/run/secrets/kubernetes.io/serviceaccount/token
  │
  ▼
CertGov API  (Authorization: Bearer <serviceaccount-jwt>)
  │  1. Detects JWT format
  │  2. Parses issuer (iss) from token
  │  3. Fetches OIDC discovery doc from {iss}/.well-known/openid-configuration
  │  4. Fetches JWKS and verifies signature (5-min cache)
  │  5. Looks up registered WI Providers matching the issuer URL
  │  6. Checks audience + subject pattern against each provider
  │  7. Returns scoped access for the first match
  ▼
Issues cert request on behalf of the matched org
```

No API key is stored in the cluster. The ServiceAccount token is short-lived (typically 1 hour) and bound to the pod.

**Configuring a Workload Identity Provider:**

Go to **Settings → Workload Identity → Add Provider** and fill in:

| Field | What to put |
| - | - |
| **Issuer URL** | Your cluster's OIDC issuer. Get it: `kubectl get --raw /.well-known/openid-configuration \| jq .issuer` |
| **Audience** | The audience the token is projected for — typically `certgov` or your CertGov instance URL. Must match the `audience` field in the certforge-issuer Helm values. |
| **Subject Pattern** | The `sub` claim of the ServiceAccount token. Format: `system:serviceaccount:<namespace>:<service-account-name>`. Use a trailing `*` as a wildcard, e.g. `system:serviceaccount:certforge-system:*` |
| **Scopes** | API scopes to grant — typically `enroll` and `mcp` for certforge-issuer. Leave empty to grant all scopes. |

The CertGov server must be able to reach the cluster's OIDC endpoint at `{issuerURL}/.well-known/openid-configuration` to fetch the signing keys. For private clusters, ensure network access from the CertGov server to the API server's OIDC endpoint.

### MCP: agents that govern their own certs

CertGov exposes an [MCP server](https://docs.certgov.app/guides/mcp.md) that AI agents can call directly. An agent can request its own certificate renewal as a first-class operation — no human in the loop for routine rotation.

```
Agent → CertGov MCP → validate API key scope → check standing grant → issue cert
```

This closes the identity lifecycle loop without requiring a Kubernetes-native cert-manager setup.

## What CertGov tracks

Once a workload cert is issued through CertGov, it enters the standard lifecycle:

* **Inventory**: every workload cert is visible alongside server certs — expiry dates, issuing CA, requesting workload, approving policy
* **Expiry alerting**: CertGov alerts before workload certs expire, just like server certs
* **Compliance rules**: you can write compliance rules that enforce rotation frequency, minimum validity periods, or required CA for workload certs
* **Audit trail**: every issuance, renewal, and revocation is logged — who (or what) requested it, which policy matched, who approved

## What CertGov provides

For workload identity, CertGov is the full issuing authority — not a governance layer over a third-party CA. It runs a platform-managed intermediate CA (backed by Azure Key Vault) that signs every workload cert directly.

| Capability | Details |
| - | - |
| **Certificate issuance** | EC P-256 certs signed by the platform intermediate; validity configured per identity |
| **Organization binding** | Every cert carries `OU=org:<your-org-id>`, set by CertGov. Your services and AWS roles require it, so other customers' certs are rejected |
| **CRL** | Rebuilt every 10 minutes and on every revocation; served from `crl.certgov.io` on Cloudflare's edge |
| **AWS Roles Anywhere** | Optional CRL push to your trust anchor through a role you control. CertGov stores no AWS keys |
| **Revocation** | Renewal blocked immediately; AWS sees it in seconds; services that load the CRL see it within 15 minutes |

You do not need to configure a CA connector for workload identity. The platform intermediate handles issuance.

## Setting up workload identity

**1. Create a workload identity**

Go to **Workload Identity → New Identity**. Set a display name, type, CN, and optional SANs. The CN is baked into every cert issued for this identity and cannot be changed after creation.

**2. Generate an enrollment token**

Open the identity and click **Generate Token**. Copy the token — it is shown only once. The workload uses this token to bootstrap its first certificate.

**3. Enroll the workload**

The workload generates a key, creates a CSR, and POSTs it with the token to `/api/enroll/workload`. CertGov ignores the CSR's CN and SANs — the cert reflects the identity configuration. After enrollment the workload authenticates all future renewals via mTLS.

**4. Configure AWS Roles Anywhere (optional)**

If the workload needs to assume AWS IAM roles, go to **Workload Identities → CRL Distribution**, add your Trust Anchor, Profile and Role ARNs, and create the CertGov push role shown there. CertGov pushes the CRL to Roles Anywhere on every revocation and on a regular schedule.

**5. Configure the services that accept the certs**

Your services must trust the CertGov CA, check revocation, and check your organization ID. See [Accepting Certs in Your Services](https://docs.certgov.app/guides/workload-identity-integration.md).

## Example: short-lived workload cert via API

```bash theme={null}
# Request a cert for a workload — first issuance, goes to approval queue
curl -X POST https://app.certgov.app/api/v1/certificates/request \
  -H "Authorization: Bearer $CERTGOV_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "domains": ["agent.analytics-pipeline.yourdomain.com"],
    "request_type": "new",
    "justification": "Analytics pipeline agent — initial identity",
    "dtp_id": "dtp_xxxxxxxxxxxxxxxxx"
  }'

# On renewal, standing grant auto-approves — no human review needed
curl -X POST https://app.certgov.app/api/v1/certificates/request \
  -H "Authorization: Bearer $CERTGOV_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "domains": ["agent.analytics-pipeline.yourdomain.com"],
    "request_type": "renewal",
    "dtp_id": "dtp_xxxxxxxxxxxxxxxxx"
  }'
```

## Further reading

* [Workload Identity: Setup & Testing](https://docs.certgov.app/guides/workload-identity-quickstart.md) — step-by-step: create an identity, generate a token, enroll, renew, verify, configure AWS Roles Anywhere
* [Accepting Certs in Your Services](https://docs.certgov.app/guides/workload-identity-integration.md) — trust, revocation and organization checks for nginx, Envoy/Istio, Go, Java and AWS
* [cert-manager integration](https://docs.certgov.app/guides/cert-manager.md) — Kubernetes-native workload cert rotation
* [certforge-issuer](https://docs.certgov.app/guides/certforge-issuer.md) — the cert-manager external issuer
* [MCP server](https://docs.certgov.app/guides/mcp.md) — AI agent self-service cert operations
* [Domain Trust Profiles](https://docs.certgov.app/concepts/domain-trust-profiles.md) — policy objects that govern issuance
* [Approval workflow](https://docs.certgov.app/concepts/approvals.md) — standing grants and auto-approve rules


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.