# Robot Accounts
Harbor allows you to use a project robot account to automate running operations for a project including,
- List Repository
- Pull Repository
- Push Repository
- Delete Repository
- Read Artifact
- List Artifact
- Delete Artifact
- Create Artifact Label
- Delete Artifact Label
- Create Tag
- Delete Tag
- List Tag
- Create Scan
- Stop Scan
- Read Helm Chart
- Create Helm Chart Version
- Delete Helm Chart Version
- Create Helm Chart label
- Delete Helm Chart label
A project robot account uses authenticates to your Harbor instance using a secret, allowing you to connect to your Harbor instance through the OCI client or Harbor API to automate tasks. Robot Accounts cannot log in to the Harbor interface.
A project robot account can only perform actions within the project that it is created in, however, Harbor v2.2 introduces the ability for system administrators to create system robot accounts in addition to creating project robot account that can automate tasks across multiple projects.
# View Project Robot Accounts
Log in to the Harbor interface with an account that has at least project administrator privileges.
Go to Projects, select a project, and select Robot Accounts.
This page lists all available project robot accounts for a project. The table lists the following information for each robot account,
The name of the robot account. This is derived from robot account prefix configured for your Harbor instance, the project name, and the name assigned to the robot account when it was created. A robot account name follows the format
<prefix><project_name>+<account_name>
. If you use the search function on this page, you only need to search for the account name without the prefix.The enabled status shows if an account is enabled or disabled.
Click the Permission(s) dropdown to view the permissions granted to the robot account.
The created time shows when the robot account was created.
The time until the project robot account expires. This is calculated based on the created time and the expiration time set when creating the project robot account.
The description of the project robot account.
You are only able to see project robot accounts from this page.
# Add a Robot Account
Log in to the Harbor interface with an account that has at least project administrator privileges.
Go to Projects, select a project, and select Robot Accounts.
Click New Robot Account.
Enter a name and an optional description for this robot account.
Set expiration time for this robot account, you can also select checkbox Never Expired if you want to create a never expiring robot account.
Click Permission(s) to grant permission to the robot account. You can use the Select All and Unselect All buttons to quickly add or remove all permissions from a robot account.
NOTE: The Push Repository permission must be assigned with the Pull Repository permission. You are not able to assign the Push Repository permission by itself.
Click Add.
In the confirmation window, click Export to File to download the access token as a JSON file, or click the clipboard icon to copy its contents to the clipboard.
⚠️ WARNING: Harbor does not store robot secret tokens, so you must either download the secret or copy and paste its contents into a text file. There is no way to get the secret from Harbor after you have created the robot account, however you are able refresh the secret after the robot account is created.
The new robot project account appears as
<prefix><project_name>+<account_name>
in the list of project robot accounts. The prefix is set by your Harbor administrator and is the same for all robot accounts.
# Edit, Disable, or Delete a Project Robot Account
You are able to edit, disable, or delete a project robot account.
From a project’s Robot Account page, select the checkbox next to the robot account you are updating.
Select Action and then Edit, Disable, or Delete.
# Refresh Project Robot Account Secret
You can refresh a robot account’s secret after its created in the event that you need a new one.
From the administrator Robot Account page, select the checkbox next to the robot account you are updating.
Select Action and then Refresh Secret.
By default Harbor will generate a new secret randomly, or you can choose to enable manually reseting the secret and entering the New Secret then Confirm Secret. Optionally, you can view the secret by clicking the eye icon.
Click Refresh. If you created a secret randomly, download the secret JSON file or copy and paste its contents.
# Authenticate with a Project Robot Account
To use a robot account in an automated process, for example, use docker login
and provide the credentials of the robot account.
docker login <harbor_address>
Username: <prefix><project_name>+<account_name>
Password: <secret>
# Robot Account Prefixes
By default, robot account names use a prefix of robot$
. Harbor uses this prefix to distinguish a robot account from a user account. The full name of a system robot account is the prefix and the name you provide when creating the robot account. For example if you create a new robot system account with the name test, the full name is robot$test
.
The same prefix is used for all robot accounts, including both system and project robot accounts. When you update this value, it will apply to all existing and future system and project robot accounts, except robot accounts created in Harbor v2.1 and earlier which will continue to use the prefix robot$
.
Log in to the Harbor interface with an account that has Harbor system administrator privileges.
Go to Configuration and select System Settings.
In the Robot Name Prefix row, modify the prefix.