SAP BTP CLI: How to use on Ubuntu 20.04

The Cloud Management Tools Feature Set B provides the SAP BTP CLI (Command Line Interface) that allows you a convenient account management on the command line. [1] This blog post describes how you get the btp CLI running on Ubuntu 20.04 (Linux).

SAP BTP CLI: Account Management on the command line
SAP BTP CLI: Account Management on the command line

SAP says that you are not only able to use the btp CLI for account management tasks on the command line but also to automate these procedures, e.g.:

  • Manage global accounts, directories, and sub-accounts
  • Set entitlements
  • Work with environments
  • Work with multi-tenant applications
  • Manage users and their authorisations

The difference between the btp CLI and the Cloud Foundry CLI (cf CLI) [2] is that you can execute all tasks on global account, directory, and sub account level on btp CLI. That means that the creation of a Cloud Foundry environment instance is the last step with the btp CLI. After that, you have to use the cf CLI for managing org members, spaces, quota and so on. [3]

Get started with BTP CLI on Ubuntu

  1. Download the the btp CLI client for Linux on https://tools.hana.ondemand.com/#cloud-cpcli [4]
  2. Extract the tar.gz archive with the following terminal command:
# Replace <name.tar.gz> with the file name
tar -vxzf <name.tar.gz> 

# -v: Displays Verbose Information 
# -x: Extract the archive 
# -z: zip, tells tar command that creates tar file using gzip
# -f: creates archive with given filename 
  1. Create for example a bin folder in the home directory if this does not exist.
# Folder in home directory
mkdir ~/bin
  1. Copy the extracted and executable btp file into the bin folder.
# Copy the btp file in the bin folder
cp ~/Downloads/linux-amd64/btp ~/bin/btp
  1. Add ~/bin to the PATH variable so that btp is always available:
# ~/bin is added to PATH
export PATH="/home/$USER/bin:$PATH"

# With this command you can check whether the path has been added
echo $PATH
# You should see something like this: "/home/<user>/bin:/home/<user>/.nvm/versions/node/v16.7.0/bin:[...]"
  1. Try to log in via btp CLI.
btp login

The above entered connection details are stored in the config.json (/home/<user>/.cache/.btp/config.json).

SAP BTP CLI: config.json
BTP CLI: config.json

Updates and btp CLI commands

You will find updates of the btp CLI on SAP Development Tools [4] and can repeat the steps 1, 2, 4, and 6.

Finally, you find information of the command syntax of the btp CLI on help.sap.com. [5]

Further information
[1] Cloud Management Tools — Feature Set Overview
[2] Tutorial “Install the Cloud Foundry Command Line Interface (CLI)
[3] Tutorial “Get Started with the SAP BTP Command Line Interface (btp CLI)
[4] SAP Development Tools (e.g. CLI)
[5] Command Syntax of the btp CLI
[6] Setting Up a Trial Account via the Command Line [Feature Set B]
[7] Commands in the btp CLI

Leave a Reply