Manage service accounts
Create tenant service accounts for automation, give them roles, control who uses them, and hand over their MLflow content before you delete them.
A service account is a non-human identity for automation in one tenant, such as a scheduled training job, a pipeline or an external application. It belongs to the tenant, not to a person, so its access and the content it creates stay in place when the person who set it up leaves.
Each service account is its own Keycloak client with a client ID and a client secret. It gets roles and groups exactly like a member. Tenant administrators create and delete service accounts; the owners of each account decide who may use it.
Use Administration → Access Control → Service accounts to manage them in the selected tenant.
Before you begin
Creating, listing, renaming and deleting service accounts is reserved for tenant administrators. The credential.service_account.* permissions come from tenant administration only; a custom role cannot carry them. Choose the intended organization in the tenant selector under Tenant in the sidebar.
| Action | Who can do it |
|---|---|
| Open Service accounts, list and inspect accounts | Tenant administrators (credential.service_account.list) |
| Create a service account | Tenant administrators (credential.service_account.create), from a signed-in session |
| Rename it or change its description | Tenant administrators (credential.service_account.update) |
| Delete a service account | Tenant administrators (credential.service_account.delete) |
| Add or remove owners | Owners of the account, and tenant administrators |
| Add or remove who can act as it | Owners of the account |
| Rotate the client secret | Owners of the account, from a signed-in session |
| Assign or remove roles | tenant.role.assign or tenant.role.revoke |
| Add it to a group or remove it | tenant.group.member_manage |
| Act as the account | Members it is granted to, and its owners, from a signed-in session |
Owners and members who act as an account must be current members of the tenant. The actions marked signed-in session refuse a personal API key.
Create a service account
- Select Create service account.
- Enter a name and an optional description. The name must be unique in the tenant and has at most 120 characters.
- Confirm. The Portal shows the client ID and the client secret.
- Copy the client secret now and store it where the workload runs. It is shown only once and cannot be retrieved later.
You become the account's first owner. Add roles and groups after creation.
Give it roles and groups
Open the service account to see its details. Under Roles, select the system and custom roles it needs; under Groups, add it to groups whose roles it should inherit. Changes save as the selection changes.
A service account's permissions are the sum of its roles and groups, the same as for a member. Its tokens carry all of them, so narrow an account by giving it fewer roles. Data Admin can be assigned to a service account as to a member.
Owners and actors
- Owners manage the account: they rotate its secret, add or remove owners, and decide who can act as it. Owners can also act as it themselves. An account always keeps at least one owner; removing the last one is refused with
400service_account_last_owner. A tenant administrator can add owners, for example to recover an account whose owners have left. - Can act as lists the members and groups allowed to run work as the account without seeing its secret, for example from a notebook.
Choose members or groups in Owners and Can act as in the account's details. Owners who are not tenant administrators use the BSQAI API routes under /v1/service-accounts/{service_account_id}/owners and /actors.
Use a service account
A workload signs in with the account's client ID and secret using the OAuth client credentials grant against the platform's Keycloak realm:
export KEYCLOAK_TOKEN_URL="https://<keycloak-host>/realms/dataplatform/protocol/openid-connect/token"
export SA_CLIENT_ID="<client-id>"
export SA_CLIENT_SECRET="<client-secret>"
curl --fail-with-body "$KEYCLOAK_TOKEN_URL" \
-d grant_type=client_credentials \
-d client_id="$SA_CLIENT_ID" \
-d client_secret="$SA_CLIENT_SECRET"The token belongs to the account's tenant, so no X-Tenant-Id header is needed. In the BSQAI API, service-account tokens are accepted by the MLflow operations; other endpoints answer 403 "Service accounts cannot use this endpoint". A service account never performs administration or protected operations.
Act as a service account
A member who may act as the account, or one of its owners, gets a short-lived token of the account with their own signed-in session. They never see the secret:
export BSQAI_BASE_URL="https://api.<platform-domain>/v1"
export BSQAI_TOKEN="<your-jwt-access-token>"
curl --fail-with-body -X POST "$BSQAI_BASE_URL/service-accounts/<service-account-id>/token" \
-H "Authorization: Bearer $BSQAI_TOKEN"The response holds access_token, token_type and expires_in. Calls made with that token are the service account's calls. A member who may not act as the account is refused with 403; GET /v1/service-accounts/{service_account_id}/act-as answers whether the caller may. Every token issued this way is recorded in the audit log with the member who asked for it.
Rotate the client secret
- Open the service account and select Rotate secret under Credentials.
- Enter the reason. It is recorded in the audit log.
- Copy the new secret and replace it wherever the account runs. It is shown only once.
Only owners can rotate, from a signed-in session. Owners who are not tenant administrators rotate with POST /v1/service-accounts/{service_account_id}/secret and a reason. The BSQAI API refuses every token issued before the rotation. Other platform services can accept an earlier token until it expires, which is a short window.
MLflow content owned by a service account
What a service account creates in MLflow, such as experiments, prompts and registered models, is owned by the service account, also when a member acting as it created it. That content keeps its owner when people leave the tenant.
- Sharing. Grant Manager, Editor and Viewer grants accept a service account as well as a user, with
subject_typeservice_account. A service account shares the content it owns under the same rules as a member owner. - Transfer. Only a tenant administrator moves ownership off a service account, from a signed-in session. Neither the service account nor a member acting as it can transfer. The tenant administrator gains no access to the content by it.
Delete a service account
A service account that still owns an experiment, prompt or registered model cannot be deleted. The deletion is refused with 409 service_account_owns_content, and the account keeps working. Hand its content over first, then delete it.
Hand over its MLflow content
When the account owns MLflow content, its details show an MLflow content section listing each item by name and kind: experiment, prompt or registered model.
- Select Transfer beside an item, or Transfer all when there are several.
- Choose the member who becomes the new owner and enter the reason. Transfer all gives every item to the same member, and each item gets its own audit record.
- Confirm. The list refreshes. If some transfers fail, the list shows what is left and the first error.
The new owner must be a current member who could create that kind of content themselves. The list shows names only, and seeing it gives no access to the content's runs, metrics or artifacts.
An experiment that was deleted but can still be restored stays in the list and needs a transfer like any other item. An experiment purged from MLflow for good, outside the platform, is cleaned up when the list is read: it drops out of the list and no longer blocks the deletion. If that cleanup fails, the experiment stays in the list under its ID until the list is read again.
The same list is available through the BSQAI API with GET /v1/mlflow/service-accounts/{service_account_id}/owned. It returns each item's kind, mlflow_id and name. Owners of the service account and tenant administrators can read it from a signed-in session; anyone else, an API key and a service account are refused with 403. Transfer each item with PUT /v1/mlflow/experiments/{experiment_id}/owner, /v1/mlflow/prompts/{name}/owner or /v1/mlflow/models/{model_name}/owner, with owner_id and reason.
Delete it
- Check that the MLflow content section is gone.
- Select Delete service account and confirm.
Deletion removes the account's Keycloak client and its roles, groups, owners and actors, including a Data Admin grant. Its credentials stop working in the BSQAI API at once, and nobody can act as it afterwards. Deletion cannot be undone.