serviceKey ​
Command:
serviceKey
Category: Connection & Auth
Status: Production Ready
Description ​
Connect to SAP HANA and write connection configuration to default-env.json via Cloud Foundry or XS Advanced HANA service key. This command retrieves service key credentials from Cloud Foundry (or XS) and automatically configures your local development environment.
Syntax ​
hana-cli serviceKey [instance] [key] [options]Aliases ​
keyservicekeyservice-key
Command Diagram ​
Parameters ​
Positional Arguments ​
| Parameter | Type | Description |
|---|---|---|
instance | string | Cloud Foundry or XS Advanced service instance name |
key | string | Service key name to create or retrieve |
Options ​
| Option | Alias | Type | Default | Description |
|---|---|---|---|---|
--instance | -i | string | - | Service instance name |
--key | -k, --key | string | - | Service key name |
--encrypt | -e, --ssl | boolean | true | Enable SSL/TLS encryption for connections |
--validate | -v, --validatecertificate | boolean | false | Enable SSL certificate validation (recommended for production) |
--cf | -c, --cmd | boolean | true | Use Cloud Foundry CLI (cf). Set to false to use XS Advanced CLI (xs) |
--save | -s | boolean | true | Save configuration to default-env.json file |
Troubleshooting ​
| Option | Alias | Type | Default | Description |
|---|---|---|---|---|
--disableVerbose | --quiet | boolean | false | Disable verbose output - removes all extra output that is only helpful to human readable interface |
--debug | -d | boolean | false | Debug hana-cli itself by adding output of LOTS of intermediate details |
For a complete list of parameters and options, use:
hana-cli connectViaServiceKey --helpExamples ​
Basic Usage (Cloud Foundry) ​
hana-cli serviceKey myInstance myKeyCreate a service key named "myKey" for instance "myInstance" using Cloud Foundry CLI, and save the configuration to default-env.json.
Using Named Parameters ​
hana-cli serviceKey --instance myHanaService --key dev-keyExplicitly specify the instance and key names.
Using XS Advanced CLI ​
hana-cli serviceKey myInstance myKey --cf falseUse XS Advanced CLI instead of Cloud Foundry CLI.
With Certificate Validation ​
hana-cli serviceKey myInstance myKey --validateEnable SSL certificate validation for enhanced security in production environments.
Without Saving Configuration ​
hana-cli serviceKey myInstance myKey --save falseRetrieve and display service key credentials without saving to default-env.json.
Related Commands ​
See the Commands Reference for other commands in this category.