- Create a Self Signed Digital Certificate first
- Create a Connected App. Upload the Digital Certificate while creating it. Keep the Consumer Key and Consumer Secret handy.
- Encrypt the server key.
- Go to your Command Prompt again and execute the following command to generate a key and initializtion vector (iv) to encrypt the server.key file locally. The key and iv are used by Bitbucket Pipeplines to decrypt the server key in the build environment. Keep the key and iv handy.
//Generate key and iv
openssl enc -aes-256-cbc -k MY_PASS -P -md sha1 -nosalt
//Encrypt the server key
openssl enc -nosalt -aes-256-cbc -in /Bitbucket/JWT/server.key -out /Bitbucket/JWT/server.key.enc -base64 -K GENERATED_KEY_IN_LAST_STEP -iv GENERATED_IV_IN_LAST_STEP
Inside the Bitbucket
- Enable Two Step Verification
- Create a Repository, entering a Project Name and Repository Name
- Go to Repository settings -> Settings -> Enable Pipelines
- Go to Repository variables and set KEY and IV

- Go to Deployment and set the Deployment Variables
- ENDPOINT – Sandbox / Production Instance url
- CONSUMER_KEY – From Connected App
- USER_NAME – Username of the Deployment Admin
Create a Project in VS Code
- Go to VS Code
- Create an empty project
- Create a folder called assets as shown in the screenshot
- Keep the server.key.enc file inside the assets folder
- Keep the bitbucket-pipelines.yml and SpecifiedTest.txt files inside the project folder as shown in the screenshot

- Connect the VS Code with the Bitbucket repository
- Checkout a feature branch in VS Code
- Commit and Push the project