Skip to Content
Technical Articles
Author's profile photo Rui Nogueira

Automating the setup of your SAP BTP account with btp-setup-automator

With the newly available GitHub repository for the btp-setup-automator we are providing the community with a script to automate the setup of an SAP Business Technology Platform (SAP BTP) account and to learn how this is done with the various command line interfaces and tools.

architectural%20overview%20btp-setup-automator

architectural overview btp-setup-automator

This includes:

  • Setup of your SAP BTP account
  • Entitlement of services
  • Subscription of applications and creation of service instances with api keys
  • Addition of administrator users to global account and subaccounts
  • Setup of roles and role collections, assignment of roles collections to users
  • Deployment of complete applications
  • Unrolling created setup

In essence it’s all about making it easier to get developers quickly onboard on SAP BTP and use services on SAP BTP without having to know too much of the terminology and how to use the SAP BTP Cockpit.

All in containers

The tooling for the btp-setup-automator is running within a Docker container and the repository provides all what you need. Why Docker? We want to ensure that you can focus on getting your work done on the SAP BTP account without having to worry whether you have the right tools in the right release for the right operating system in place.

Sounds already good, but there is a cherry on top: we provide you as well the pre-built Docker image in our GitHub account at https://github.com/SAP-samples/btp-setup-automator/pkgs/container/btp-setup-automator as a package.

For further reading on improving the developer experience through containers, see this three-part blog post series from my colleague DJ Adams: Boosting tutorial UX with dev containers.

CLIs: Sitting (not standing) on the shoulders of giants

The tool is there to prove how much you can already automate today with the various command line interfaces (CLIs) on SAP BTP. The btp-setup-automator uses:

  • SAP btp CLI
  • Cloud Foundry CLI
  • The Cloud Foundry plugin for MTA files
  • kubectl (including the kubelogin extension)
  • helm
  • krew (maybe you want some more kubectl extensions 😊)

Maybe the tool inspires you to create your own tool to automate the setup of your SAP BTP account. And it is so easy and powerful that you don’t even have to stand on the shoulders of giants but can rather sit very relaxed on their shoulders 😊.

Open source

The repository is available under the Apache 2.0 license. It is written in Python and the log files produced by the tool show you which commands you need to use to carry out certain tasks in, for example, the SAP btp CLI to entitle a subaccount to use a service, or how you can create a service instance in your subaccount using the Cloud Foundry CLI.

You can learn through the log files what you need to do in which sequence.

And if you feel like something should be done differently in the code: fork the GitHub repo of btp-setup-automator and send a pull request to the repository or adapt the code to your needs.

 

The use cases

You might already know the use cases for the SAP Business Technology Platform. The btp-setup-automator wants to make it easier for you to set up the SAP BTP part in your SAP BTP account.
As a user of the btp-setup-automator you focus on a specific use case via a file with a defined JSON structure. You can find several examples in the repository and – of course – you can create your own use case files as well.
These configuration files tell the tool which services and service plans are needed.

With the release today we are providing you configurations for the following use cases:

Just follow the instructions on the GitHub repository for btp-setup-automator and see how easy it is to setup your SAP BTP account with services and subscriptions.

If you hit issues please raise an issue in the repo, we are happy to fix and improve the tool.

Share your experience

To be straight: this tool is not the silver bullet for all possible tasks around SAP BTP. It is focusing on the setup of an SAP BTP account and the creation of service instances and app subscriptions. But even more importantly it wants to inspire you on how easy it is to integrate SAP BTP within your development processes.

Maybe you even start your own GitHub project around SAP BTP.

Share your experience with us here in the SAP Community or inside the “Discussions” tab of the project. Let us know your thoughts on how you are using the btp-setup-automator for your development with SAP BTP.

Best,
Rui for the contributors of the #btp-setup-automator

Assigned Tags

      18 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Mathias Held
      Mathias Held

      BTP command line is really useful, we use it in similar case to add sub-accounts, subscriptions, role collections and assign users groups to them

      Author's profile photo Wallace Henry
      Wallace Henry

      Perhaps a small clarification question...

      BTP Account verses Global Account?  Equal/same, different?  While not optimal, perhaps, it is possible to have multiple global accounts active within a single SAP customer?

      I see both referenced in the first part of the post.

       

      Author's profile photo Rui Nogueira
      Rui Nogueira
      Blog Post Author

      In general a customer has one global account on SAP BTP. Here's the official documentation around this topic: https://help.sap.com/docs/BTP/65de2977205c403bbc107264b8eccf4b/8ed4a705efa0431b910056c0acdbf377.html?locale=en-US

      Best,
      Rui

      Author's profile photo Mustafa Bensan
      Mustafa Bensan

      Does this mean all three BTP commercial models can now be combined in a single global account?

      • CPEA Cloud Credits
      • CPEA PAYG
      • Subscription

       

      Author's profile photo Rui Nogueira
      Rui Nogueira
      Blog Post Author

      No :-). That's why I've said "in general".

      If you run the tool, you'll notice that you get in the "metada_log.json" file some information about the type of account you use. That information is bound to the global account.

      Author's profile photo Marco Dorn
      Marco Dorn

      Hello Wallace Henry,

      Let me add to what Rui wrote: One customer can have several Global Accounts indeed. When you look at the link Rui shared, it starts with: "A global account is the realization of a contract you made with SAP." If there are several contracts, there can be multiple Global Account. Only if  these additional contracts are all upsells of the initial contract, there would be only one subscription based Global Account.

      Furthermore, to clarify on Mustafa Bensan's comment: Since Q1 2021, it's as well possible to have a subscription-based Global Account merged with a consumption-based one (CPEA or PayG). It's not possible to have CPEA+PayG as this won't make sense anyway. If there is over consumption in a CPEA contract, the used credits on top are invoiced.

      I hope this clarifies further.

      Best regards,
      Marco

      Author's profile photo Mustafa Bensan
      Mustafa Bensan

      Hi Marco,

      Thanks for the further commentary.  As I understand it, if a customer starts with a PAYG based global account, they can in future seamlessly transition the same global account to a CPEA model without any rework or migration of the existing deployed applications.  Is that right?

      Regards,

      Mustafa.

      Author's profile photo Marco Dorn
      Marco Dorn

      Hello Mustafa,

      The move from PayG to CPEA is an even easier one as this is only a contractual change from "no financial commitment" to "committed credits". Therefore, the technical account gets only an updated "commercialModel" flag, but nothing else changes.

      Best regards,
      Marco

      Author's profile photo Johannes Goerlich
      Johannes Goerlich

      Hi Marco Dorn,

      I'm wondering if there is something like a CCC functionality for Global Accounts?

      How can I get knowledge of existing Global Accounts in my company?

      How can I keep track if a contract for a Global Account with my desired commercial models already exists within a different department and whos the contact far that?

      Do we need some kind of CASB to get visibility of SAP BTP usage?

       

      Best regards,

      Johannes

      Author's profile photo Rui Nogueira
      Rui Nogueira
      Blog Post Author

      Hi Johannes, not sure what CCC or CASB is. Maybe Marco Dorn knows more here.

      As far as I know there is currently no means to find out via the BTP CLI which user has access to which SAP BTP global account. And as the btp-setup-automator is using the various CLIs, we can't provide that information through the btp-setup-automator.

      Best,
      Rui

      Author's profile photo Marco Dorn
      Marco Dorn

      Hello Johannes Goerlich,

      Same here, I am not sure what you mean by CCC-functionality.

      From what I know, it's not possible to get the information about all Global Accounts for an account via the CLI or the BTP cockpit.

      Maybe this is possible via SAPforMe (documentation)? Oguzhan Genis, can you help out with more details?

      Best regards,
      Marco

      Author's profile photo Johannes Goerlich
      Johannes Goerlich

      thank you both for picking this up.

      @Marco Dorn 

      With SAP BTP, we fear to run into the same issues as we had in the past for example with AWS or Azure where each department could order a separate account by entering a credit card number ending in several not-governed accounts, no proper cost optimization and unstructured service usage.

      CCC is the abbreviation for the SAP Corporate Group function of the "on-prem world". Quote from the documenation "A CCC group allows more than one account (customer number) to be joined together in a Corporate Group hierarchy, so that S-Users with CCC Level authorizations, can manage the accounts. Features such as managing installations, systems, license keys, incidents, and S-Users, are enabled with the proper CCC level authorizations."

      AWS introduced a similar concept with the "AWS Organizations".

      A CASB solution could be used to scan the network traffic in order to find out which cloud solutions are used from the company's network. Or even to prevent users from ordering SaaS solutions by circumventing the organisational requirements or processes.

       

      Best regards,

      Johannes

      Author's profile photo Mustafa Bensan
      Mustafa Bensan

      Hi Rui,

      Your post and samples are exactly what was needed!  As for "it wants to inspire you", it is certainly a motivation to extend this for the use case of the provisioning and onboarding tasks for multi-tenant SaaS applications.  It would be very useful if the SAP BTP CLI and API could also support Registering a System in future, to allow even further automation.

      Regards,

      Mustafa.

      Author's profile photo Rui Nogueira
      Rui Nogueira
      Blog Post Author

      Thanks a lot Mustafa.

      Please go ahead and add a feature request to the repository at https://github.com/SAP-samples/btp-setup-automator/issues/new/choose

      Or maybe you even want to get your hands dirty and create a pull request for that feature?

      Best,

      Rui

      Author's profile photo Tom Dhooghe
      Tom Dhooghe

      Seems like a very useful way to abstract away the CLI details and specifics in favour of a set of JSON service descriptors. The biggest potential I'd see however would be to automatically create such a use case file as a blueprint from an established subaccount. Not sure if the APIs would even support that though? Last I checked a lot of services and instances didn't allow retrieving their configuration.

      Author's profile photo Rui Nogueira
      Rui Nogueira
      Blog Post Author

      That's a cool idea and exactly the reason why I've started this open source project. Did you already give the tool a try? You could as well have a look into the SAP btp CLI and play with it a bit. When using the btp-setup-automator you get as a side-effect all the commands that the script uses. This includes various calls of the SAP btp CLI.

      My personal favorite command for the SAP btp CLI is this one:

      btp --format json list accounts/entitlement --global-account "<your global account subdomain>"

      The json that you get back provides you with a huge amount of data and if you combine that with additional commands (see the official documentation), you suddenly are seeing yourself creating your own (open source) project that is using those commands.

      In any case, you should add your feature request into the GitHub repo at at https://github.com/SAP-samples/btp-setup-automator/issues/new/choose . We can take it from there and see, whether someone (or even you) is willing to pick-up the task and integrate it into the btp-setup-automator.

      I personally like the idea very much. Thanks a lot for your input!

      Best,
      Rui

      Author's profile photo Eric Gleiss
      Eric Gleiss

      Hi colleagues,

      is there a way to execute BTP CLI commands from within a Jenkins pipeline? If I understand it correctly, one has to install the BTP CLI client before being able to execute commands. Is there something like a plugin or a docker image that could be used?

      Thanks and best regards,
      Eric

      Author's profile photo Yevgen Trukhin
      Yevgen Trukhin

      Hi Eric, in the past I had my own image with btp cli that I maintained and executed within Jenkins, now you can use the image "ghcr.io/sap-samples/btp-setup-automator:main" in your pipeline.

       

      Br Yevgen