Skip to content

Document user-managed service accounts and workflow execution - #8921

Open
eedugon wants to merge 48 commits into
mainfrom
service_accounts_user_managed
Open

eedugon wants to merge 48 commits into
mainfrom
service_accounts_user_managed

Conversation

@eedugon

@eedugon eedugon commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary (9.6 feature, DO NOT MERGE until release date)

The service accounts documentation currently describes only built-in identities, while Workflows authorization assumes execution as a user. This draft documents user-managed service accounts for Elastic Stack 9.6 on Elastic Cloud Hosted, Elastic Cloud Enterprise, Elastic Cloud on Kubernetes, and self-managed deployments, with Kibana as the starting point for account creation.

Related to elastic/docs-content-internal#1733. The scope follows the Tier 1 guidance in Larry's detailed implementation notes. Serverless availability remains marked as unavailable, with follow-up notes for documenting its differences when enabled.

Coverage

  • Extend the service accounts overview to distinguish built-in and user-managed accounts, explain principals and roles, and cover service token creation, authentication, identity verification, and audit attribution.
  • Add a Kibana management guide covering creation, account review, updates and deactivation through the Elasticsearch API, and deletion. Explain credential ownership, complete PUT replacement semantics, and the separate revocation of API keys owned by an account.
  • Add a guide for creating an additional service token and authenticating requests to Kibana APIs as a user-managed account.
  • Add a Workflows guide for assigning an account with settings.run_as, verifying execution identity, testing saved workflows, handling identity and permission failures, and removing assignments.
  • Update Workflows authorization, permissions, triggers, step documentation, navigation, and authentication cross-links to account for the new execution model while retaining the existing user-based behavior.

Review

Major updates are in the following docs:

Draft review points

  • Workflows permissions: the current Kibana code requires manage_security to edit or delete an already-bound workflow as well as to change its assignment. Larry's notes describe the requirement as binding-only. The draft follows the code and includes an internal release-check comment; confirm the intended 9.6 behavior and update the related pages together if needed.

  • Recheck the account creation and role-selection UI after elastic/kibana#296889 lands.

  • Companion reference work remains in the product repositories: Kibana service account settings, audit event lifecycle labels, and the query service accounts API link when available. Internal follow-up comments identify these items.

Generative AI disclosure

  1. Did you use a generative AI (GenAI) tool to assist in creating this contribution?
  • Yes
  • No

OpenAI Codex assisted with drafting, product-source research, editing, and validation. The documentation was refined iteratively with the author. SME review is still needed for the permissions discrepancy and the release-dependent UI details listed above.

Closes elastic/docs-content-internal#1733

@github-actions

Copy link
Copy Markdown
Contributor

Elastic Docs AI PR menu

Check the box to run an AI review for this pull request.

  • Review docs changes (docs-review). Status: not started.

Powered by GitHub Agentic Workflows and docs-actions. For more information, reach out to the docs team.

@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

🔍 Preview links for changed docs

More links …

@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Elastic Docs Style Checker (Vale)

Summary: 1 warning, 1 suggestion found

⚠️ Warnings (1): Fix when the suggestion improves clarity or correctness.
File Line Rule Message
explore-analyze/workflows/authorization.md 70 Elastic.Spelling 'auditability' is a possible misspelling.
💡 Suggestions (1): Optional style improvements. Apply when helpful.
File Line Rule Message
explore-analyze/workflows/steps/kibana.md 22 Elastic.Repetition "to" is repeated.

The Vale linter checks documentation changes against the Elastic Docs style guide. To use Vale locally or report issues, refer to Elastic style guide for Vale.


:::{note}
:applies_to: {"stack": "ga 9.6+", "serverless": "unavailable"}
For a workflow bound to a service account, **Triggered by** identifies the user who starts the workflow or last saved it, depending on the trigger. **Run as** identifies the service account used for authorization. Refer to [Run a workflow as a service account](/explore-analyze/workflows/authoring-techniques/run-workflow-as-service-account.md).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also not sure about this but @shahargl probably knows best - i think triggered by will have the SA shown in triggered by..

@eedugon eedugon Oct 29, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated it after further reviewing of the code. I think you are right, in certain cases (depending on the type of trigger and the identity used to initiate the run), the triggered by could identify a SA (it doesn't need to be the same SA shown in run_as).

For workflows assigned to a service account, Triggered by shows the identity associated with the start of the run, which can be a user or a service account. Run as shows the assigned service account used for authorization.

But of course if @shahargl is able to confirm it, that would be great.

@shainaraskas shainaraskas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did a quick review of the core service account docs. will keep going tomorrow

@shainaraskas shainaraskas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

last major page. more tomorrow 🐌

@bmorelli25 bmorelli25 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⛷️ OK 👍

**Q: How can I create {{serverless-full}} service accounts?**
A: Create API keys for service accounts in your {{serverless-short}} projects. You can create them in {{kib}}, with the {{es}} API, or as code with Terraform. Refer to [](/deploy-manage/api-keys/serverless-project-api-keys.md) for details.
**Q: How can I create {{serverless-full}} service accounts?**<br>
A: You can [create user-managed service accounts in {{kib}}](/deploy-manage/users-roles/cluster-or-deployment-auth/manage-service-accounts-in-kibana.md) for use within {{kib}} applications, such as [Workflows](/explore-analyze/workflows.md). For programmatic access from external applications, use [API keys](/deploy-manage/api-keys.md).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@talboren : I've updated the PR to show serverless availability.
It would be great to get a final review if possible.

Preserve service account execution identities and the expanded trigger documentation from main.

AI-Assisted: Codex

@shainaraskas shainaraskas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still wip on reviewing the smaller changes on other pages but here are the main pages


{applies_to}`serverless: unavailable` To use the account from an external API client, [create a separate named service token](authenticate-kibana-api-with-service-account.md#create-service-account-api-token).

### Roles and privileges in {{serverless-short}} [service-account-serverless-roles]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could bump this to an h2 as it's important context not limited to the creation flow

Comment on lines +81 to +92
### Service accounts in {{serverless-short}} [service-accounts-serverless]
```{applies_to}
serverless: ga
```

{{serverless-short}} uses the same [built-in service accounts](#built-in-service-accounts), with credentials managed by Elastic.

User-managed accounts have a generated identifier that is independent of the name you enter in {{kib}}. Their identifiers don't use the `<namespace>/<service>` principal format of {{stack}} accounts.

You can assign a user-managed account to a workflow, and {{kib}} manages the short-lived credentials used to run it. You can't obtain a token for an external application or manage these accounts through the {{es}} service account APIs. The service token instructions on this page apply to {{stack}}.

The account's privileges are limited to those allowed by both its assigned roles and its creator's access at creation time. For details about role limits, cross-project search, and deleting accounts, refer to [Create and manage service accounts in {{kib}}](manage-service-accounts-in-kibana.md).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

most of this is duplicative with the rest of the page. it also puts tiny serverless details in a dedicated section when they would be more helpful next to their stack counterparts. by paragraph:

  1. the structure of the page implies that built in service accounts are avail for serverless already (we could clarify about management in the built-in service acconts section)
  2. generated identifier is useful but maybe could just be paired with the kibana namespace info above: "In {{stack}}, accounts created in {{kib}} use the kibana namespace, and their principals have the form kibana/<name>."
  3. we explain this where we explain user-managed service accounts above
  4. we explain this where we explain creation on the child page. prob not necessary for this parent

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

section reworked! thanks for the proposal.

The `settings.run_as` field specifies the ID of the account that runs the workflow. On {{stack}} deployments, this is the account's principal, such as `kibana/incident-response`. On {{serverless-short}}, it is a generated identifier independent of the account's name.

You can assign an existing account or create one without leaving the workflow editor. In both cases, the account must be [created in {{kib}}](/deploy-manage/users-roles/cluster-or-deployment-auth/manage-service-accounts-in-kibana.md) and have the roles required by the workflow steps. Accounts created directly through the {{es}} API can't be used for workflow execution, even if they use the `kibana` namespace.
You can assign an existing account or create one without leaving the workflow editor. In both cases, the account must be [created in {{kib}}](/deploy-manage/users-roles/cluster-or-deployment-auth/manage-service-accounts-in-kibana.md) and have the privileges required by the workflow steps.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused - it says you can create this without leaving the editor, but then says the account must be created (which implies pre-creation)

When you [assign a service account](/explore-analyze/workflows/authoring-techniques/run-workflow-as-service-account.md) with `settings.run_as`, every run uses that account's privileges. The trigger type and the user who last saved or started the workflow don't change its privileges.

The workflow stores a reference to the account. When a run starts, {{kib}} obtains a short-lived credential and renews it as needed. {{es}} resolves the account's roles whenever it authenticates, so changes to an assigned role apply to later credential requests without saving the workflow again.
The workflow stores a reference to the account. When a run starts, {{kib}} obtains a short-lived credential and renews it as needed. Changes to an assigned role affect the account's privileges without saving the workflow again.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps? "affect" is a little confusing

Suggested change
The workflow stores a reference to the account. When a run starts, {{kib}} obtains a short-lived credential and renews it as needed. Changes to an assigned role affect the account's privileges without saving the workflow again.
The workflow stores a reference to the account. When a run starts, {{kib}} obtains a short-lived credential and renews it as needed. Edits to an assigned role update the account's privileges. You don't need to save the workflow again.

serverless: unavailable
```

A service account token, or service token, is a unique string that a service uses to authenticate with {{es}}. For a given service account, each token must have a unique name. Because tokens include access credentials, they should always be kept secret by whichever client is using them.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A service account token, or service token, is a unique string that a service uses to authenticate with {{es}}.

We state above (correctly) that these tokens can also authenticate to Kibana. Is it confusing that this only says {{es}}?

For a given service account, each token must have a unique name.

This feels out of place in a section talking about tokens. I'd remove it.

Because tokens include access credentials, they should always be kept secret by whichever client is using them.

pedantic nit-picking: The tokens are credentials, they don't include credentials.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes implemented, thanks!

You can create a service token using either:

We recommend that you create service tokens via the REST API rather than the CLI. The API stores service tokens within the `.security` index which means that the tokens are available for authentication on all nodes, and will be backed up within cluster snapshots. The use of the CLI is intended for cases where there is an external orchestration process (such as [{{ece}}](/deploy-manage/deploy/cloud-enterprise.md) or [{{eck}}](/deploy-manage/deploy/cloud-on-k8s.md)) that will manage the creation and distribution of the `service_tokens` file.
* The [create service account token API]({{es-apis}}operation/operation-security-create-service-token) (recommended). The API stores the token in the `.security` index and returns the bearer token in the HTTP response. Tokens are available for authentication on all nodes and are included in cluster snapshots.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The API is only viable if you're not going to use them for Kibana workloads (such as Workflows). If the Service Account is to be used for Kibana workloads, then it must be created within Kibana. Otherwise Kibana won't have the opportunity to create its own managed token.

edit: I see you make this distinction on the child Manage service accounts page.


* The [create service account token API]({{es-apis}}operation/operation-security-create-service-token), which saves the new service token in the `.security` index and returns the bearer token in the HTTP response.
* Self-managed and {{eck}} deployments only: The [elasticsearch-service-tokens](elasticsearch://reference/elasticsearch/command-line-tools/service-tokens-command.md) CLI tool, which saves the new service token in the `$ES_HOME/config/service_tokens` file and outputs the bearer token to your terminal
You can create a service token using either:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't mention the Kibana UI in this list

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was on purpose, as Kibana UI cannot really be used to create service tokens more than the Fleet (elastic/fleet) service token. Did you mean that?

Adding it just in case.

@shainaraskas shainaraskas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

couple higher sev ones in here like the malformed applies tag + the kibana page-level tag

otherwise good job reconciling two similar but not same experiences!

Co-authored-by: shainaraskas <58563081+shainaraskas@users.noreply.github.com>
Co-authored-by: Larry Gregory <lgregorydev@gmail.com>
alexandra5000 pushed a commit to alexandra5000/docs-content that referenced this pull request Nov 9, 2026
…tic#9168)

## Summary

In Stack 9.6 and later, a user-managed service account can call the
Agent Builder APIs with a service token, using its own identity and
privileges. Serverless can't create these accounts, so every new section
is scoped `stack: ga 9.6+` and `serverless: unavailable`.

Closes elastic/docs-content-internal#2137.

## What changed

| Page | Change |
|---|---|
| `permissions.md` | New **Service accounts** section under **Configure
access**, covering authentication and required privileges. New **Service
accounts in conversations** section under **Conversation access
control**, covering ownership, public conversations, and adding the
account as a member. **The member role** links to it. |
| `kibana-api.md` | New **Chat as a service account** example. The
**Update conversation access control** example now covers service
account member IDs. |
| `chat.md` | New **Messages from a service account** subsection,
including how a workflow can set `author_name`. **Share a conversation**
now notes that service accounts don't appear in the user search, are
hidden from the member lists, and count toward the sharing button total.
|
| `programmatic-access.md` | One line pointing service account clients
to `permissions.md`. |

## Dependency

How to create a user-managed service account and its token is documented
in elastic#8921. `%` comments in `permissions.md` and
`kibana-api.md` mark where to link
`authenticate-kibana-api-with-service-account.md` after elastic#8921 merges.
Until then, the token link points to the existing service accounts page,
which covers built-in accounts only.

This branch was successfully deployed

1 active deployment
docs-preview — 679a6b6d Deployed Nov 9, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants