---
title: Integrate with Jenkins
slug: kronpam-how-to-guides/integrate-with-jenkins
description: Enhance Jenkins job security and streamline access to secrets stored in Kron PAM AAPM with the Kron PAM Secret Plugin. Prevent exposure of sensitive information in Jenkins jobs while enjoying the flexibility of Jenkins script projects and global configura
docTags: 
createdAt: 2022-08-17T14:04:43.000Z
---

The Kron PAM Secret Plugin makes secrets that are stored in Kron PAM AAPM securely available to Jenkins jobs. Jenkins jobs can authenticate to the AAPM account and access the specific secret values.

This plugin offers advantages to both Kron PAM and Jenkins users. The Kron PAM Secret Plugin stores secret values securely and prevents secrets from being exposed in Jenkins jobs. It also provides flexibility with the support of Jenkins script projects as well as global configurations.

With this plugin, Jenkins job is simplified by requiring only a URL or reference ID to a secret, and the configuration is made easy for Jenkins users with a familiar user interface.

# Installing Jenkins

:::hint{type="info"}
**Prerequisites:**

- You must have a fully functioning Kron PAM AAPM configured.
- You must have a fully functioning Jenkins host configured and running.
:::

To obtain the .hpi file and upload it using the Jenkins UI:

1. Download the **SingleConnectSecretPlugin.hpi** file to your computer
2. When you have the .hpi file, log into Jenkins as an administrator

::Image[]{src="https://api.archbee.com/api/optimize/g9cApVza9NIhSh0pjZYtA/n0GSnmofh291bfV-URNQ4_image.png" size="60" width="268" height="231" position="center" showCaption="false"}

- Navigate to **Dashboard** > **Manage Jenkins** > **Manage Plugins** > **Advanced** tab.



![](https://api.archbee.com/api/optimize/g9cApVza9NIhSh0pjZYtA/YrRfjWk_pK3nUA3FwC00I_image.png)

- In the **Upload Plugin** section, browse for **SingleConnectSecretPlugin.hpi** and **Upload&#x20;**&#x69;t to Jenkins.



![](https://api.archbee.com/api/optimize/g9cApVza9NIhSh0pjZYtA/Hg1PZyLoL8cCScSmp_Qhq_image.png)

- &#x20; After installing the plugin, restart Jenkins.
- &#x20; Navigate to **Dashboard** > **Manage Jenkins** > **Manage Plugins** > **Installed** tab.
- &#x20; Make sure your plugin is listed under the **Installed Plugins** before continuing with the configuration.

# Configuring Jenkins

## Adding Credential

The first configuration requirement for Jenkins is to add the credential.

1. Navigate to **Dashboard** > **Manage Jenkins** > **Manage Credentials** > **Credentials** > **System** > **Global credentials** **(unrestricted).**
2. Click on Jenkinsstore and it will direct you to **System** > **Global Credentials** **(unrestricted)** > **Add Credentials.**

::Image[]{src="https://api.archbee.com/api/optimize/g9cApVza9NIhSh0pjZYtA/cxQ7yIinOjBLnLt8rsQEf_image.png" size="76" width="538" height="149" position="center" showCaption="false"}

## Defining the Secret

The second configuration requirement for Jenkins is to store the credentials to connect to an AAPM account. The secrets that you want to obtain to connect to the AAPM account must be defined explicitly.

1. Select the credential kind from the drop-down a&#x73;**&#x20;Kron PAM** **Credential**.
2. Select the **Scope** as **Global (Jenkins, nodes, items, all child items, etc.)**.
3. Enter the URL for your localhost to define secrets:
   *https\://\[local host]/sc-aapm-ui/rest/aapm/password*
4. Enter data as follows:
   *\{"token":" 9d0e79b4-5fb5-4836-824b-13d9d2cc909f","tenantId":"host", "comment":"abc", "passwordChangeRequired":"FALSE", "passwordExpirationInMinute":"5"}*
5. Enter ID type as AAPM SECRET 2.
6. Click **Save** to save and store the AAPM secret through Jenkins UI.

![](https://api.archbee.com/api/optimize/g9cApVza9NIhSh0pjZYtA/sTNsPYOkgPQfAsn6y7Ww9_image.png)

## Usage

1. First, create a project of your choice. In this example, a freestyle project is selected.

![](https://api.archbee.com/api/optimize/g9cApVza9NIhSh0pjZYtA/2qvhNdF74Ztv12cp4s5Wz_image.png)

- Then, navigate to **Dashboard** > **Project Name** (Test Project 2) and click on the down arrow to select **Configure**.

::Image[]{src="https://api.archbee.com/api/optimize/g9cApVza9NIhSh0pjZYtA/JwBlrkKplSEYtqWY3Efg__image.png" size="22" width="111" height="177" position="center" showCaption="false"}

- You will be directed to the configuration page; from there, navigate to the **Build Environment** tab.
- To bind to the AAPM secret, select **Use secret text(s) or file(s)**
- Navigate to the **Bindings** tab or scroll down to the **Bindings** section and click **Add**.
- Select Kron PAM Secret Credential and the following will be selected automatically for you:
  variable as SINGLECONNECT\_SECRET
  specific credential as Kron PAM Credential: AAPM SECRET 2
- *(Optional)* You can add more than one credential if needed by using the **Add** button once **Specific credentials&#x20;**&#x61;re selected. By adding the credential, you injected the secret as an environment variable to the build step of the project.
- Navigate to the **Build** tab, click **Add Build Step** and select a build step. In the following example, we used Execute Shell.

::Image[]{src="https://api.archbee.com/api/optimize/g9cApVza9NIhSh0pjZYtA/FzTgB2Fuu7BtV3yJ96uqm_image.png" size="64" width="641" height="379" position="center" showCaption="false"}



- Run the command below (with your own naming conventions) to access the account using the secret variable you bound:
  \#!/bin/bash
- Click to finish the project configurations.

You successfully integrated Jenkins with Kron PAM AAPM.

Check if you see the logs under SAPM Logs.

![](https://api.archbee.com/api/optimize/g9cApVza9NIhSh0pjZYtA/1qkOnAqAc8-ViqR26d0sG_image.png)

