Skip to content

Commit 7a43455

Browse files
authored
Merge pull request #18462 from BeSAP/master
update to support free tier service plans
2 parents 772216e + 89fca48 commit 7a43455

File tree

1 file changed

+31
-23
lines changed

1 file changed

+31
-23
lines changed

tutorials/cp-cli-automate-operations/cp-cli-automate-operations.md

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,24 @@ title: Automate Account Operations with the Command Line Interface (CLI)
33
description: Automate your account administrative flows with the SAP BTP command line interface (btp CLI).
44
author_name: Michal Keidar
55
author_profile: https://github.com/michal-keidar
6+
creator_name: Benjamin Buehner
7+
creator_profile: https://github.com/BeSAP
68
auto_validation: true
79
time: 30
8-
tags: [tutorial>intermediate, products>sap-business-technology-platform, software-product-function>sap-btp-cockpit, software-product-function>sap-btp-command-line-interface]
9-
primary_tag: products>sap-business-technology-platform
10+
tags: [tutorial>intermediate, software-product-function>sap-btp-cockpit, software-product-function>sap-btp-command-line-interface]
11+
primary_tag: software-product>sap-business-technology-platform
12+
---
13+
14+
## Prerequisites
15+
- You have an account on SAP BTP. You can check out steps 1-7 of the tutorial on how to [Get an Account on SAP BTP to Try Out Free Tier Service Plans](btp-free-tier-account) (we will automate the rest in this tutorial here).
16+
- You have the Cloud Foundry CLI, as described in [Installing the cf CLI](https://docs.cloudfoundry.org/cf-cli/install-go-cli.html).
17+
- You have a UNIX-like environment.
18+
19+
## Details
20+
21+
### You will learn
22+
- How to use a script to automate account admin processes
23+
1024
---
1125

1226
With the introduction of cloud management tools feature set B to SAP BTP, the stars of the show are without a doubt the new REST APIs and command line. With these features, you now have many more options to automate your account administrative flows in SAP BTP.
@@ -38,7 +52,7 @@ For this example, you can download an automation script that we've prepared in a
3852

3953
The script will do the following: 
4054

41-
1. Log in to your global account on SAP BTP. 
55+
1. Log in to your global account on SAP BTP. 
4256

4357
2. Create a new directory in your account model. 
4458

@@ -52,16 +66,10 @@ The script will do the following: 
5266

5367
7. Create a space in the Cloud Foundry org of one of the subaccounts.
5468

55-
8. Create an instance of the SAP HANA Cloud (`hana`) service in the space.
69+
8. Create an instance of the SAP HANA Cloud (`hana-free`) service in the space.
5670

5771
Through this tutorial, we hope we can help you to unleash the power of CLI script-based automation for your account admin processes on SAP BTP.
5872

59-
## Prerequisites
60-
- You have a trial account on SAP BTP. For a trial account, see [Get a Free Account on SAP BTP Trail](hcp-create-trial-account).
61-
- You have the Cloud Foundry CLI, as described in [Installing the cf CLI](https://docs.cloudfoundry.org/cf-cli/install-go-cli.html).
62-
- You have a UNIX-like environment.
63-
64-
6573
---
6674

6775
[ACCORDION-BEGIN [Step 1: ](Download and install the client)]
@@ -78,13 +86,13 @@ Download the automation script file from GitHub: <https://github.com/SAP-samples
7886

7987

8088
[ACCORDION-BEGIN [Step 3: ](Change the declarations)]
81-
In this step, you need to open the script file in your favorite text editor and enter the values in each placeholder according to your trial account and the names and custom properties of the directories and subaccounts that you want to create.
89+
In this step, you need to open the script file in your favorite text editor and enter the values in each placeholder according to your account and the names and custom properties of the directories and subaccounts that you want to create.
8290

8391
These lines declare global variables that will be used in the script. 
8492

8593
```Bash
86-
declare region="<enter your trial region, e.g., eu10, us10, ap21>"
87-
declare global_account_subdomain="<enter your trial global account subdomain, see below where it is located>"
94+
declare region="<enter your region, e.g., eu10, us10, ap21>"
95+
declare global_account_subdomain="<enter your global account subdomain, see below where it is located>"
8896
declare directory_name="<enter a name for the directory of the new project, e.g., Project X>"
8997
declare directory_description="<enter a description for the directory of the new project, e.g., Directory for project X of partner Y>"
9098
declare contact_person="<enter the email address of your partner company´s contact person>"
@@ -149,7 +157,7 @@ login_btp() {
149157
>Two-factor authentication is only relevant for Password grant type authorization.
150158
151159

152-
The following function creates a new directory in your trial global account, with the name and description that you provided in Step 3.
160+
The following function creates a new directory in your global account, with the name and description that you provided in Step 3.
153161

154162
In addition, it sets the directory features, admin, and custom properties. 
155163
There are two custom properties here: 
@@ -187,8 +195,8 @@ The following function assigns the service and plan it receives as input, as an
187195

188196
In the `main` function of the script, we'll use the following function to assign two service entitlements to your directory:
189197

190-
- SAP Alert Notification service (`standard`)
191-
- SAP HANA Cloud (`hana`)
198+
- SAP Alert Notification service (`free`)
199+
- SAP HANA Cloud (`hana-free`)
192200

193201
Since `distribute` and `auto-assign` are specified, every subaccount that is created in or moved to the directory will automatically be assigned these entitlements as well (as long as the directory has remaining quota for these services). 
194202

@@ -263,7 +271,7 @@ create_cf_environment() {
263271
--subaccount "$subaccount_id" \
264272
--environment cloudfoundry \
265273
--service cloudfoundry \
266-
--plan standard \
274+
--plan free \
267275
--parameters "{\"instance_name\":\"$display_name\"}"
268276

269277
}
@@ -342,8 +350,8 @@ main() {
342350
log "Directory creation initiated, ID is $directory_id"
343351

344352
# Add two service entitlements that child subaccounts will get
345-
assign_distributed_entitlement "$directory_id" alert-notification standard
346-
assign_distributed_entitlement "$directory_id" hana-cloud-trial hana
353+
assign_distributed_entitlement "$directory_id" alert-notification free
354+
assign_distributed_entitlement "$directory_id" hana-cloud hana-free
347355

348356
# Create the dev, test, prod subaccounts in the directory
349357
log Initiating creation of subaccounts ...
@@ -371,9 +379,9 @@ main() {
371379
# Create new space and target it
372380
create_new_space "$org" "$space"
373381

374-
# Create SAP HANA Cloud trial service instance in targeted space
375-
echo Creating SAP HANA Cloud trial service ...
376-
cf create-service hana-cloud-trial hana hana_instance \
382+
# Create SAP HANA Cloud service instance in targeted space
383+
echo Creating SAP HANA Cloud service ...
384+
cf create-service hana-cloud hana-free hana_instance \
377385
-c '
378386
{
379387
"data": {
@@ -413,7 +421,7 @@ Open your terminal in the location in which you saved it, then execute i
413421

414422
[ACCORDION-BEGIN [Step 6: ](See the results)]
415423

416-
Once the script has finished executing, open your SAP BTP Trial cockpit and locate the new directory, subaccounts, entitlements, org, space, and the instance of the SAP HANA Cloud service. 
424+
Once the script has finished executing, open your SAP BTP cockpit and locate the new directory, subaccounts, entitlements, org, space, and the instance of the SAP HANA Cloud service. 
417425

418426
Here's what you should find.
419427

0 commit comments

Comments
 (0)