--- title: "Create the delegated issuance identity" description: "Create a dedicated service user for the delegated team with one least-privilege Trust Lifecycle Manager role and an expiration date." source_url: https://dev.digicert.com/solutions/governed-tls-issuance/phase-3-delegated-identity.html --- # Create the delegated issuance identity Create a dedicated service user for the delegated team with one least-privilege Trust Lifecycle Manager role and an expiration date. ## Phase metadata - Phase: 3 - Workstream: Service identity — Step 1 of 1 - Product: Account Manager - Goal: The delegated team has a dedicated, expiring service user that holds only the issuance role, and its token is in the team's secret manager. - Estimated time: 15 minutes - Inputs: admin_api_token, account_id, issuance_role_name, service_user_name, credential_custodian_email, service_user_end_date - Prerequisite: [Define the governance boundary](https://dev.digicert.com/md/solutions/governed-tls-issuance/phase-1-governance-boundary.md) Use DigiCert® Account Manager to create the delegated service user, the non-human identity the delegated team uses to request certificates. The central PKI team runs this phase with its setup credential. The service user: - Serves one team and one purpose. - Holds a single least-privilege DigiCert® Trust Lifecycle Manager role. - Expires on a known date. The profile in [Publish the governed issuance profile](https://dev.digicert.com/md/solutions/governed-tls-issuance/phase-4-governed-profile.md) binds to its token, so no other credential can issue through that profile. ## Phase prerequisites Make sure you have: - The `account_id` from [Define the governance boundary](https://dev.digicert.com/md/solutions/governed-tls-issuance/phase-1-governance-boundary.md). - The least-privilege issuance role from [Before you begin](https://dev.digicert.com/md/solutions/governed-tls-issuance.md#before-you-begin). - A service user name that identifies the team and purpose, such as `payments-platform-tls-issuance-nonprod`. Don't reuse one service user across teams or environments. - The email address of the person who manages the service user's credentials. - An expiration date for the service user, aligned to your credential rotation policy. - A setup credential with the **User manager** role, or a role with the **Manage users** permission. ## Endpoints used | Method | Path | Purpose | |--------|------|---------| | GET | `/account/api/v1/role` | Find the API name of the least-privilege issuance role. | | POST | `/account/api/v1/user` | Create the service user and return its API token once. | | GET | `/account/api/v1/user/{user_id}` | Confirm the service user's roles, permissions, account, and expiration. | ## Step 3.1: Find the issuance role Find the API `name` of the issuance role. Account Manager assigns roles by that name, which can differ from the display name in the product and between tenants. List the account's Trust Lifecycle Manager roles. The `application_code` filter returns only the `enterprise_manager` product key, where these roles are: **cURL** ```bash curl --fail-with-body --silent --show-error \ -X GET "https://demo.one.digicert.com/account/api/v1/role" \ -H "x-api-key: ${ADMIN_API_TOKEN}" \ -G \ --data-urlencode "application_code=enterprise_manager" \ --data-urlencode "account_id=${ACCOUNT_ID}" \ -o roles.json ``` **Python** ```python response = requests.get( f"{base_url}/account/api/v1/role", headers={"x-api-key": admin_api_token}, params={ "application_code": "enterprise_manager", "account_id": account_id, }, timeout=30, ) response.raise_for_status() roles = response.json() Path("roles.json").write_text(response.text) ``` A successful request returns `200 OK` with the roles under `enterprise_manager`. The sample shows two of them: ```json { "enterprise_manager": [ { "id": "", "name": "EM_EPKI_USER_&_CERT_MANAGER", "display_name": "User and certificate manager", "description": "EPKI User & cert manager", "type": "default", "status": "ACTIVE", "access_scope": "account" }, { "id": "", "name": "EM_PAYMENTS_PLATFORM_TLS_ISSUANCE", "description": "Payments platform team: certificate issuance only", "type": "custom", "status": "ACTIVE", "access_scope": "account" } ] } ``` A custom role has no `display_name`, so identify the role by its `name`. Find the active issuance role under `enterprise_manager` in `roles.json`, and replace `` with its `name`. The selection stops unless exactly one active role has that name: **cURL** ```bash ISSUANCE_ROLE_NAME="" jq --arg issuance_role_name "${ISSUANCE_ROLE_NAME}" ' [.enterprise_manager[] | select(.name == $issuance_role_name and .status == "ACTIVE")] | if length == 1 then .[0] else error("expected one match, found \(length)") end ' roles.json > role.json jq '{name, display_name, type, status}' role.json ``` **Python** ```python issuance_role_name = "" matches = [ item for item in roles["enterprise_manager"] if item["name"] == issuance_role_name and item["status"] == "ACTIVE" ] if len(matches) != 1: raise LookupError(f"Expected one match, found {len(matches)}") role = matches[0] Path("role.json").write_text(json.dumps(role, indent=2)) print(json.dumps({ "name": role["name"], "display_name": role.get("display_name"), "type": role["type"], "status": role["status"], }, indent=2)) ``` Confirm that `type` is `custom`. If you use the predefined **User and certificate manager** role for a demo-tenant validation, its `name` is `EM_EPKI_USER_&_CERT_MANAGER`. > **Warning** > > Don't give the delegated service user a role or permission that lets the team change its own constraints. That removes the separation between the central PKI team and the delegated team. > > - **Manager**, **Certificate profile manager**, and **Custom attribute manager** let the team change the profile, metadata, and business unit that constrain it. > - `MANAGE_EM_CUSTOM_ATTRIBUTES` covers more than mapping metadata. Don't add it to the issuance role, even to let the team map its own metadata. ## Step 3.2: Create the delegated service user Create the service user with one role, one account, and an expiration date. Replace the name, email address, expiration, and description with your own: **cURL** ```bash jq -n \ --arg account_id "${ACCOUNT_ID}" \ --arg issuance_role_name "${ISSUANCE_ROLE_NAME}" \ '{ user_type: "service", friendly_name: "payments-platform-tls-issuance-nonprod", email: "pki-credential-custodian@example.com", accounts: [$account_id], roles: [$issuance_role_name], end_date: "2027-01-31T23:59:59Z", description: "Payments platform team: non-production TLS issuance through the governed profile" }' | curl --fail-with-body --silent --show-error \ -X POST "https://demo.one.digicert.com/account/api/v1/user" \ -H "x-api-key: ${ADMIN_API_TOKEN}" \ -H "Content-Type: application/json" \ --data-binary @- \ -o delegated-service-user.json ``` **Python** ```python response = requests.post( f"{base_url}/account/api/v1/user", headers={"x-api-key": admin_api_token}, json={ "user_type": "service", "friendly_name": "payments-platform-tls-issuance-nonprod", "email": "pki-credential-custodian@example.com", "accounts": [account_id], "roles": [issuance_role_name], "end_date": "2027-01-31T23:59:59Z", "description": "Payments platform team: non-production TLS issuance through the governed profile", }, timeout=30, ) response.raise_for_status() delegated_service_user = response.json() Path("delegated-service-user.json").write_text(response.text) ``` | Field | Value | Source | |-------|-------|--------| | `friendly_name` | A name that identifies the team and purpose | You choose it. Don't reuse one service user across teams or environments. | | `email` | The address of the person who manages the service user's credentials | Your credential custodian | | `end_date` | The expiration, in `YYYY-MM-DDTHH:MM:SSTZD` format | Your credential rotation policy | | `description` | The owning team, purpose, and profile scope | You choose it | This request isn't safe to repeat. If the result is uncertain, look for a service user with the exact `friendly_name` in the account before you send it again. A successful request returns `201 Created` with the service user and its first API token. In the response: - `api_token.name` is the service user's `friendly_name`. - `api_token.end_date` matches the service user's `end_date`. - The API normalizes `end_date` to `23:59:59Z` on the date you send. The sample shows a service user that holds the recommended custom role: ```json { "id": "", "email": "pki-credential-custodian@example.com", "status": "ACTIVE", "access_scope": "account", "primary_account_id": "", "created_at": "TZ", "friendly_name": "payments-platform-tls-issuance-nonprod", "description": "Payments platform team: non-production TLS issuance through the governed profile", "api_token": { "id": "", "user_id": "", "name": "payments-platform-tls-issuance-nonprod", "token": "", "end_date": "2027-01-31T23:59:59Z", "enabled": true }, "accounts": [ { "id": "", "name": "", "active": true, "service_period": { "from": "", "to": "" }, "friendly_identifier": "", "locale": "en_US" } ], "applications": [ { "id": "", "name": "Trust Lifecycle", "app_code": "enterprise_manager", "permissions": [ "CREATE_EM_CERTIFICATE", "VIEW_EM_CERTIFICATE", "MANAGE_EM_VIEWS", "VIEW_EM_ENROLLMENT", "MANAGE_EM_ENROLLMENT" ], "roles": [ "EM_PAYMENTS_PLATFORM_TLS_ISSUANCE" ] } ], "end_date": "2027-01-31T23:59:59Z" } ``` > **Important** > > The API returns `api_token.token` only in this response, and you can't recover it later. Two local files hold it until the following steps move it to the delegated team's secret manager and delete them: > > - `delegated-service-user.json`, the saved response. > - `service-api-token.secret`, which the save writes without printing the token. > > If you lose the token, create a replacement for the same service user, as described in [Rotate the delegated team's token](https://dev.digicert.com/md/solutions/governed-tls-issuance/operate.md#rotate-the-delegated-teams-token). Save three different values: - The user `id` as `service_user_id`. Audit log searches use it. - `api_token.id` as `api_token_id`. The profile binds to it. - `api_token.token` as `service_api_token`. The delegated team sends it in the `x-api-key` header. **cURL** ```bash SERVICE_USER_ID="$(jq -er '.id' delegated-service-user.json)" API_TOKEN_ID="$(jq -er '.api_token.id' delegated-service-user.json)" umask 077 jq -ej '.api_token.token' delegated-service-user.json > service-api-token.secret SERVICE_API_TOKEN="$(cat service-api-token.secret)" export SERVICE_USER_ID API_TOKEN_ID SERVICE_API_TOKEN jq '{id, status, end_date, "api_token.id": .api_token.id}' delegated-service-user.json ``` **Python** ```python service_user_id = delegated_service_user["id"] api_token_id = delegated_service_user["api_token"]["id"] service_api_token = delegated_service_user["api_token"]["token"] Path("service-api-token.secret").touch(mode=0o600) Path("service-api-token.secret").write_text(service_api_token) print(json.dumps({ "id": delegated_service_user["id"], "status": delegated_service_user["status"], "end_date": delegated_service_user["end_date"], "api_token.id": delegated_service_user["api_token"]["id"], }, indent=2)) ``` Confirm that `status` shows the user is active and `end_date` matches the expiration you set. Keep the user `id` and `api_token.id` in a file without the token, so you can restore them after you delete the saved response. This is a local command, the same for both the cURL and Python paths: ```bash jq '{id, api_token: {id: .api_token.id}}' delegated-service-user.json > delegated-service-user-ids.json ``` Move the token to the delegated team's secret manager. Then delete `delegated-service-user.json` and `service-api-token.secret`. ## Step 3.3: Verify the identity's scope Before you bind a profile to this service user's token in [Publish the governed issuance profile](https://dev.digicert.com/md/solutions/governed-tls-issuance/phase-4-governed-profile.md), confirm that its access is what you intended. Retrieve the service user: **cURL** ```bash curl --fail-with-body --silent --show-error \ -X GET "https://demo.one.digicert.com/account/api/v1/user/${SERVICE_USER_ID}" \ -H "x-api-key: ${ADMIN_API_TOKEN}" | jq '.' ``` **Python** ```python response = requests.get( f"{base_url}/account/api/v1/user/{service_user_id}", headers={"x-api-key": admin_api_token}, timeout=30, ) response.raise_for_status() print(json.dumps(response.json(), indent=2)) ``` A successful request returns `200 OK` with the service user's accounts, roles, and permissions, without the API token. The sample shows the service user from the create response: ```json { "id": "", "email": "pki-credential-custodian@example.com", "status": "ACTIVE", "access_scope": "account", "primary_account_id": "", "created_at": "TZ", "user_type": "service", "friendly_name": "payments-platform-tls-issuance-nonprod", "description": "Payments platform team: non-production TLS issuance through the governed profile", "locale": "en_US", "applications": [ { "id": "", "name": "Trust Lifecycle", "app_code": "enterprise_manager", "permissions": [ "CREATE_EM_CERTIFICATE", "VIEW_EM_CERTIFICATE", "MANAGE_EM_VIEWS", "VIEW_EM_ENROLLMENT", "MANAGE_EM_ENROLLMENT" ], "roles": [ "EM_PAYMENTS_PLATFORM_TLS_ISSUANCE" ] } ], "accounts": [ { "id": "", "name": "", "active": true, "service_period": { "from": "", "to": "" }, "friendly_identifier": "", "locale": "en_US" } ], "disable_api_access_token": false, "disable_cac_upload": false, "end_date": "2027-01-31T23:59:59Z" } ``` Check each field: | Field | Expected value | |-------|----------------| | `user_type` | `service` | | `status` | `ACTIVE` | | `access_scope` | `account` | | `accounts[].id` | Only `account_id` | | `applications` | A `Trust Lifecycle` entry whose `app_code` is `enterprise_manager`. No other entry lists roles. | | `applications[].roles` | Only `issuance_role_name` | | `applications[].permissions` | Only the issuance permissions you intended | | `end_date` | The expiration you set | For a custom role with **Certificates**, **Create**, and **Enrollment** (**Manage**), `permissions` lists `CREATE_EM_CERTIFICATE`, `VIEW_EM_CERTIFICATE`, `MANAGE_EM_VIEWS`, `VIEW_EM_ENROLLMENT`, and `MANAGE_EM_ENROLLMENT`. Without `MANAGE_EM_ENROLLMENT`, the issuance request returns `403`. The predefined **User and certificate manager** role lists many more permissions, including seat and report management. Add the service user to your service user register. The DigiCert® Trust Architecture Playbook treats service users as privileged identities, because their tokens request certificates from a pipeline without anyone signing in. Record these items in each entry: - An owner and a purpose. - A profile scope. - Expiration and rotation dates. - An access review status. - An emergency disable path. For this service user, that's [Disable the delegated team's token in an emergency](https://dev.digicert.com/md/solutions/governed-tls-issuance/operate.md#disable-the-delegated-teams-token-in-an-emergency). ## Phase 3 checkpoint - [ ] `service_user_id` and `api_token_id` are in `delegated-service-user-ids.json`, the token is in the delegated team's secret manager, and you deleted `delegated-service-user.json` and `service-api-token.secret`. - [ ] The service user holds exactly one role, `issuance_role_name`, for Trust Lifecycle Manager, in exactly one account. - [ ] The service user has an expiration date, and its register entry records its owner, purpose, scope, rotation date, access review status, and emergency disable path. When you also complete [Approve the private CA source](https://dev.digicert.com/md/solutions/governed-tls-issuance/phase-2-approved-ca-source.md), continue to [Publish the governed issuance profile](https://dev.digicert.com/md/solutions/governed-tls-issuance/phase-4-governed-profile.md). ## Outputs and handoff | Output | Produced in | Used by | | --- | --- | --- | | `service_user_id` | Create the delegated service user: response `id` | [Issue and evidence a governed certificate](https://dev.digicert.com/md/solutions/governed-tls-issuance/phase-5-governed-issuance.md) | | `api_token_id` | Create the delegated service user: response `api_token.id` | [Publish the governed issuance profile](https://dev.digicert.com/md/solutions/governed-tls-issuance/phase-4-governed-profile.md) | | `service_api_token` | Create the delegated service user: response `api_token.token` | [Issue and evidence a governed certificate](https://dev.digicert.com/md/solutions/governed-tls-issuance/phase-5-governed-issuance.md) |