Service Accounts ¶
Service accounts enable you to create a Prefect Cloud API key that is not associated with a user account. Service accounts are typically used to configure API access for running workers or executing deployment flow runs on remote infrastructure.
Service accounts are non-user accounts that have the following features:
Using service account credentials, you can configure an execution environment to interact with your Prefect Cloud workspaces without a user having to manually log in from that environment. Service accounts may be created, added to workspaces, have their roles changed, or deleted without affecting other user accounts.
Select Service Accounts to view, create, or edit service accounts.
Service accounts are created at the account level, but individual workspaces may be shared with the service account. See workspace sharing for more information.
Service account credentials
When you create a service account, Prefect Cloud creates a new API key for the account and provides the API configuration command for the execution environment. Save these to a safe location for future use. If the access credentials are lost or compromised, you should regenerate the credentials from the service account page.
Service account roles
Service accounts are created at the account level, and can then be added to workspaces within the account.
A service account may only be a Member of an account. It can never be an account Admin. You may apply any valid workspace-level role to a service account.
Create a service account¶
Within your account, on the Service Accounts page, select the + icon to create a new service account. You'll be prompted to configure:
- The service account name. This name must be unique within your account.
- An expiration date, or the Never Expire option.
Service account roles
A service account may only be a Member of an account. You may apply any valid workspace-level role to a service account when it is added to a workspace.
Select Create to create the new service account.
Note that API keys cannot be revealed again in the UI after you generate them, so copy the key to a secure location.
You can change the API key and expiration for a service account by rotating the API key. Select Rotate API Key from the menu on the left side of the service account's information on this page.
To delete a service account, select Remove from the menu on the left side of the service account's information.