Before we can start the process of automatically deploying our application to Rancher we need to setup the API access keys that will allow you to use the Rancher Command Line Interface and API.
Load up Rancher and log in as your administrator account and make sure that you are in the correct environment ( you will need to do this process in each environment that you will be deploying to ) and then go to the API menu.
There are two kinds of API keys in Rancher. There are Account Keys and Environment Keys. The environment api keys are under the advanced settings and you will need to click on that to expand the section. You should also take a note of the API Endpoint URL as you will need this later.
Click on the ‘Add Environment API Key’ button and give your new key a name. I’ve called mine VSTS Access. Then click on the Create button.
The new API key will be displayed, it consists of two parts, the access key and the secret key. As noted this is the ONLY time the secret key will ever be displayed so you must take a note of it.
Make sure you do this for all your deployment environments and keep a note of the keys and endpoint urls ( they change per environment also )