A2oz

How Do I Create a Personal Access Token in Jenkins?

Published in Jenkins 2 mins read

You can create a personal access token in Jenkins by following these steps:

  1. Log in to your Jenkins instance.
  2. Go to your user profile. You can find this by clicking your username in the top right corner of the Jenkins dashboard.
  3. Select "Configure" from the menu.
  4. Navigate to the "API Token" section.
  5. Click "Add new token".
  6. Provide a descriptive name for the token.
  7. Select the permissions you want to grant to this token. This could include read-only access, write access, or administrative access.
  8. Click "Generate".
  9. Copy the generated token. This token will be displayed only once, so make sure to copy it securely.

Important: Treat your personal access token like a password. Never share it with anyone and keep it secure.

Example:

Let's say you need a personal access token to automate a Jenkins job using a script. You can create a token with "Read" permissions to allow your script to fetch job information.

Practical Insights:

  • You can use personal access tokens for various purposes, such as automating Jenkins tasks, integrating with external tools, or accessing Jenkins APIs.
  • It's recommended to generate a separate token for each purpose and with the minimum necessary permissions.
  • You can revoke a token at any time if you no longer need it.

Related Articles