Getting Started with Cloud Foundry CLI
Hello and Welcome Everyone.
Here today I will try to put some light on the cloud foundry command line interface which is a very helpful tool while working with cloud foundry enviornment.
I have recently started working with the CF CLI so thought to share the same information to everyone so I could help our community as well.
So, As I said we have the option to use CF CLI to work on the Cloud foundry apart from the UI we have in BTP.
To began with the CF CLI we need to install the CLI in our machines. To get the required installation file visit the website mentioned below.
Based on the flavor of your OS(Window , MAC) select the right installation file to download.
Extract the software.
Right click and execute and install the software. ( Put them in the following directory C:\Users\<username>\AppData\Roaming\Cloud Foundry>)
After executing the installer follow the installation wizard to install the CLI in above specified location.
Here we have installed it for Window. Now we have the CF CLI installed in the machine.
Change the directory.
Now execute the command to login into the cloud foundry. Make sure you have appropriate role in CF and you are the part of CF org member.
Command – cf7 login ( I am using the CF CLI version 7, Hence CF7 login)
Now it will ask for the API endpoint which you can find in your subaccount in BTP as shown below.
Login to your BTP Global account.
Now navigate to the Subaccount where you have the cloud foundry activated.
Now on same screen below you will see the Cloud Foundry Environment and here you can find the API endpoint detail.
Now CLI will seek for the user and password.
Note- If you have any issue using username and password as shown below then use option 2 for sso.
Option 1- Username and password
Option 2 – Login using SSO
Now use the below input to login with the SSO.
CF(version) login –sso -a https://APIENDPOINT URL
For my case it is as below
cf7 login –sso -a https://api.cf.eu20.hana.ondemand.com
Now It will provide a temporary passcode to login by using the URL mentioned in the CLI screen after executing the command.
Now we have to copy the URL highlighted and run into the browser to get the temp passcode to login as shown below.
Note- We have to use the same Suer ID and password which is registered with the subaccount where we have the CF activated and we are having the required authorization’s as well CF as earlier mentioned.
It will open page like this, where we must select the second option of alternative identity provider where in now it will use the SAP ID service when you already have an SAP Universal login where you can use your SUSER and credentials to get the temp passcode to login.
Copy the code and paste into the CF CLI to login as shown below.
Now you are logged in into the CF.
As shown above the org are the subaccount where I have the CF activated.