Skip to content

Playbook Backup and Restore

Steps to Configure GitHub Playbooks Backup and Restore

1. GitHub Credentials in APIsec can be saved via Personal Access Token or SSH

Reading time < 3 min
1.1 To configure GitHub Credentials in APIsec via Personal Access Token
Step 1: Generate the PAT in Github.
To generate the PAT refer to the following GitHub documentation. Select the below scopes while generating the PAT.
1. Full control of private repositories
2. Update GitHub Action workflows
3. Read org and team membership, read org projects
4. Create gists.
Once the scopes are selected, the PAT is generated.
Step 2: In the APIsec project, Go to Configurations > Integrations
Click on Git Backup > +New Credentials. A New Credentials Pop-Up window appears.
image
Add a name for the credential along with the Personal Access Token.
Click on Add. The credentials will be saved in the APIsec Vault.

1.2 Backup Playbooks in GitHub
Step 1: Go to GitHub and create a new Repository with a README file. Copy the 'Git Repository HTTPS URL' as shown in the below image.
image
Step 2: Go to Configurations > Integrations > Playbook Backup in the project of APIsec.
Paste the GitHub repository URL extracted from Step 1 under the GitHub repository URL field. Now click on the 'GitHub access credentials' dropdown and select your registered credential. Click Save and enable the Active toggle button.
image
Once these configurations are completed, the playbooks will be auto-synced into your GitHub repository.
image

2.1 To configure credentials for GitHub Playbooks Backup via SSH
Step 1: Open a Git Bash terminal on your local machine.
Step 2. Enter the following command: ssh-keygen -t ecdsa -m PEM to generate the Public and Private keys.
Step 3. The generated keys will be stored on your local drive. Extract the Public key from your drive and paste it into your GitHub account under the GitHub SSH Settings.
Step 4. Go to Configurations > Integrations > Playbook Backup in the project of APIsec.
image
Click on Playbook Backup > +New Credentials. A New Credentials Pop-Up window appears.
Add a name to this credential. Retrieve the Private key generated in Step 2 from your local drive, paste it into the Private Key field, and click on Add. The credentials will be saved in the APIsec Vault.

2.2 Backup Playbooks in GitHub
Step 1: Go to GitHub and create a new Repository with a README file. Copy the 'Git Repository SSH URL' as shown in the below image.
Screenshot 2024-02-09 191341
Step 2: Go to Configurations > Integrations > Playbook Backup in the project of APIsec.
Paste the GitHub repository URL extracted from Step 1 under the GitHub repository URL field. Now click on the 'GitHub access credentials' dropdown and select your registered credential. Click Save and enable the Active toggle button.
image
Once these configurations are completed, the playbooks will be auto-synced into your GitHub repository.

Steps to Restore Playbooks from the GitHub Repository

Step 1: Once the GitHub Credentials are configured and the playbook backup has been done as described in the 1.1 and 2.1 sections, the playbooks can be restored in APIsec. For this, Go to Configurations > Playbooks
Step 2: Click on Bulk Create/Delete Playbooks. Select All from the categories drop-down list. Check Delete Custom Playbooks and click Submit.
image
Step 3: Go to GitHub and open the Repository where the playbooks have been backed up. Copy the 'Git Repository URL' as shown in the below image. image
Step 4: Go to Configurations > Integrations > Playbook Backup in the project of APIsec.
image
Paste the GitHub repository URL extracted from Step 3 under the GitHub repository URL field. Now click the 'GitHub access credentials' dropdown and select your registered credential. Click Save and enable the Active toggle button.

Once these configurations are completed, the playbooks will be auto-synced into APIsec from the GitHub repository.