| name | cf-cli-reference |
| description | Reference skill for all CF CLI operations — session management, full command taxonomy (apps, services, routes, orgs/spaces, admin, quotas), MultiApps plugin (cf deploy/mta), JSON output patterns, and scope boundaries. Intended to be read by other skills before issuing CF CLI commands. |
| disable-model-invocation | false |
| allowed-tools | Read, Bash |
CF CLI Reference
Complete reference for the Cloud Foundry CLI (cf) — session management, full command taxonomy, MultiApps plugin commands, JSON output patterns, and scope boundaries. Use this skill as a toolset when other skills need to issue CF CLI commands.
CLI Version and Architecture
cf --version
cf plugins
The CF CLI operates against the CF API — it manages apps, services, routes, spaces, and orgs within a Cloud Foundry organization. It does NOT manage the BTP account layer (subaccounts, entitlements, trust, global security) — those require the btp CLI or BTP REST APIs.
Two distinct plugin ecosystems:
- Built-in CF CLI — core app and service management
- MultiApps CLI plugin — MTA deployment (
cf deploy, cf mta, etc.) — REQUIRED for SAP BTP MTA deployments
Session Management
Login
cf login -a <API_ENDPOINT> -u <email> -p <password> -o <org> -s <space>
cf login -a <API_ENDPOINT> --sso
cf login -a <API_ENDPOINT> --sso-passcode <PASSCODE>
cf login -a <API_ENDPOINT> -u <email> --origin <idp-origin>
cf login -a <API_ENDPOINT> --skip-ssl-validation
SAP BTP CF API endpoints by region:
| Region | API Endpoint |
|---|
| EU10 (Frankfurt) | https://api.cf.eu10.hana.ondemand.com |
| EU11 (Frankfurt) | https://api.cf.eu11.hana.ondemand.com |
| EU20 (Netherlands) | https://api.cf.eu20.hana.ondemand.com |
| US10 (Virginia) | https://api.cf.us10.hana.ondemand.com |
| US20 (WA) | https://api.cf.us20.hana.ondemand.com |
| US21 (Virginia) | https://api.cf.us21.hana.ondemand.com |
| AP10 (Sydney) | https://api.cf.ap10.hana.ondemand.com |
| AP11 (Singapore) | https://api.cf.ap11.hana.ondemand.com |
| AP12 (Seoul) | https://api.cf.ap12.hana.ondemand.com |
| AP20 (Sydney) | https://api.cf.ap20.hana.ondemand.com |
| AP21 (Singapore) | https://api.cf.ap21.hana.ondemand.com |
| JP10 (Tokyo) | https://api.cf.jp10.hana.ondemand.com |
| BR10 (São Paulo) | https://api.cf.br10.hana.ondemand.com |
| CA10 (Canada) | https://api.cf.ca10.hana.ondemand.com |
| CH20 (Switzerland) | https://api.cf.ch20.hana.ondemand.com |
| IN30 (India) | https://api.cf.in30.hana.ondemand.com |
Non-Interactive Auth (for scripts)
cf auth <CLIENT_ID> <CLIENT_SECRET> --client-credentials
cf target -o <ORG> -s <SPACE>
Targeting
cf target
cf target -o <ORG> -s <SPACE>
cf api https://api.cf.eu11.hana.ondemand.com
cf api
cf logout
Session Health Check
cf target
cf oauth-token
Environment Variables
| Variable | Purpose |
|---|
CF_HOME | Override config directory (default: ~/.cf/) |
CF_TRACE=true | Enable diagnostic HTTP tracing |
CF_COLOR=false | Disable output colors |
CF_DIAL_TIMEOUT | Timeout for TCP connections |
CF_STAGING_TIMEOUT | Max time for staging (default: 15 min) |
CF_STARTUP_TIMEOUT | Max time for app start (default: 5 min) |
CF_PLUGIN_HOME | Override plugin directory |
Gotchas
- Session expires —
cf target fails with "Not logged in." Run cf login again.
cf login vs cf auth — cf login is interactive (sets org/space); cf auth --client-credentials is for scripts (still requires cf target separately).
- Two spaces to manage — CF org/space context is separate from BTP subaccount context.
cf target does not know about your BTP subaccount.
--format json does NOT exist in CF CLI — CF CLI has no global JSON output flag. Use cf curl for raw API JSON, or parse text output with grep/awk.
- MultiApps plugin required —
cf deploy is NOT a built-in command; it requires the MultiApps CLI plugin installed separately.
cf push vs cf deploy — cf push deploys a single app from a manifest.yml; cf deploy deploys an MTA (Multi-Target Application) from mtad.yaml using the MultiApps plugin.
- Stuck MTA operations — check with
cf mta-ops, abort with cf deploy -i <operation-id> -a abort.
cf restage vs cf restart — cf restart stops and starts without re-staging; cf restage re-runs the buildpack (needed after changing env vars that affect staging).
- WAR filename = Tomcat context path — The SAP Java buildpack deploys
ROOT.war at /, myapp.war at /myapp. Always use ROOT.war.
cf logs --recent — only shows the last ~1000 lines from the Loggregator buffer; for full logs use cf logs <app> --recent or stream with cf logs <app>.
Apps Group
Core App Lifecycle
cf apps
cf app <APP_NAME>
cf app <APP_NAME> --guid
cf push <APP_NAME> [flags]
-b <BUILDPACK>
-c <COMMAND>
-f <MANIFEST_PATH>
-i <INSTANCES>
-k <DISK>
-m <MEMORY>
-o <DOCKER_IMAGE>
-p <PATH>
-s <STACK>
-t <TIMEOUT>
-u <HEALTH_CHECK_TYPE>
--endpoint <PATH>
--no-manifest
--no-route
--no-start
--no-wait
--random-route
--strategy rolling
--task
--var <KEY=VALUE>
--vars-file <FILE>
cf scale <APP_NAME>
-i <INSTANCES>
-k <DISK>
-m <MEMORY>
--process <PROCESS>
-f
cf start <APP_NAME>
cf stop <APP_NAME>
cf restart <APP_NAME>
--strategy rolling
cf restage <APP_NAME>
cf delete <APP_NAME>
-f
-r
cf rename <APP_NAME> <NEW_NAME>
cf restart-app-instance <APP_NAME> <INSTANCE_INDEX>
--process <PROCESS>
cf cancel-deployment <APP_NAME>
Logs and Diagnostics
cf logs <APP_NAME>
cf logs <APP_NAME> --recent
cf events <APP_NAME>
cf env <APP_NAME>
cf set-env <APP_NAME> <VAR_NAME> <VALUE>
cf unset-env <APP_NAME> <VAR_NAME>
Manifest and Health Checks
cf create-app-manifest <APP_NAME>
-p <PATH>
cf get-health-check <APP_NAME>
--process <PROCESS>
cf set-health-check <APP_NAME> <TYPE>
--endpoint <PATH>
--invocation-timeout <N>
--process <PROCESS>
SSH
cf ssh <APP_NAME>
-i <INDEX>
-c <COMMAND>
-L <LOCAL:REMOTE>
--process <PROCESS>
-t
-T
--force-pseudo-tty
-k
-N
cf ssh-code
cf enable-ssh <APP_NAME>
cf disable-ssh <APP_NAME>
cf ssh-enabled <APP_NAME>
Tasks and Packages
cf run-task <APP_NAME> --command "<CMD>"
--name <TASK_NAME>
-m <MEMORY>
-k <DISK>
--process <PROCESS>
cf tasks <APP_NAME>
cf terminate-task <APP_NAME> <TASK_ID>
cf packages <APP_NAME>
cf create-package <APP_NAME>
-p <PATH>
cf droplets <APP_NAME>
cf set-droplet <APP_NAME> <DROPLET_GUID>
cf download-droplet <APP_NAME>
--path <PATH>
cf stacks
cf stack <STACK_NAME>
Revisions (Experimental)
cf revisions <APP_NAME>
cf revision <APP_NAME> <REVISION_NUMBER>
cf rollback <APP_NAME> --version <REVISION_NUMBER>
Services Group
Service Instances
cf marketplace
cf marketplace -e <SERVICE_OFFERING>
cf marketplace -s <SPACE>
cf services
cf service <SERVICE_INSTANCE_NAME>
cf create-service <OFFERING> <PLAN> <INSTANCE_NAME>
-b <BROKER>
-c '{"key":"val"}'
-t "tag1,tag2"
-w
cf update-service <INSTANCE_NAME>
-c '{"key":"val"}'
-p <NEW_PLAN>
-t "tag1,tag2"
-w
cf upgrade-service <INSTANCE_NAME>
-f
cf delete-service <INSTANCE_NAME>
-f
-w
cf rename-service <INSTANCE_NAME> <NEW_NAME>
Service Keys (Credentials)
cf service-keys <INSTANCE_NAME>
cf service-key <INSTANCE_NAME> <KEY_NAME>
--guid
cf create-service-key <INSTANCE_NAME> <KEY_NAME>
-c '{"key":"val"}'
cf delete-service-key <INSTANCE_NAME> <KEY_NAME>
-f
-w
Service Binding
cf bind-service <APP_NAME> <INSTANCE_NAME>
-c '{"key":"val"}'
--binding-name <NAME>
cf unbind-service <APP_NAME> <INSTANCE_NAME>
cf bind-route-service <DOMAIN> <INSTANCE_NAME>
-f
-n <HOSTNAME>
--path <PATH>
cf unbind-route-service <DOMAIN> <INSTANCE_NAME>
-f
-n <HOSTNAME>
--path <PATH>
cf share-service <INSTANCE_NAME>
-s <SPACE>
-o <ORG>
cf unshare-service <INSTANCE_NAME>
-s <SPACE>
-o <ORG>
-f
User-Provided Services
cf create-user-provided-service <NAME>
-p "param1,param2"
-p '{"key":"val"}'
-l <SYSLOG_URL>
-r <ROUTE_SERVICE_URL>
-t "tag1,tag2"
cf update-user-provided-service <NAME>
-p '{"key":"val"}'
-l <SYSLOG_URL>
-r <ROUTE_SERVICE_URL>
-t "tag1,tag2"
Routes and Domains Group
cf domains
cf create-private-domain <ORG> <DOMAIN>
cf delete-private-domain <DOMAIN>
-f
cf create-shared-domain <DOMAIN>
--internal
--router-group <GROUP>
cf delete-shared-domain <DOMAIN>
-f
cf router-groups
cf routes
--orglevel
cf route <HOSTNAME> <DOMAIN>
--path <PATH>
cf check-route <HOSTNAME> <DOMAIN>
--path <PATH>
cf create-route <DOMAIN>
-n <HOSTNAME>
--path <PATH>
--port <PORT>
cf map-route <APP_NAME> <DOMAIN>
-n <HOSTNAME>
--path <PATH>
--port <PORT>
--destination-protocol <http1|http2>
cf unmap-route <APP_NAME> <DOMAIN>
-n <HOSTNAME>
--path <PATH>
--port <PORT>
cf delete-route <DOMAIN>
-n <HOSTNAME>
--path <PATH>
--port <PORT>
-f
cf delete-orphaned-routes
-f
Orgs and Spaces Group
cf orgs
cf org <ORG>
--guid
cf create-org <ORG>
cf delete-org <ORG>
-f
cf rename-org <ORG> <NEW_NAME>
cf spaces
cf space <SPACE>
--guid
--security-group-rules
cf create-space <SPACE>
-o <ORG>
--quota <SPACE_QUOTA>
cf delete-space <SPACE>
-o <ORG>
-f
cf rename-space <SPACE> <NEW_NAME>
cf apply-manifest
-f <MANIFEST_PATH>
cf allow-space-ssh <SPACE>
cf disallow-space-ssh <SPACE>
cf space-ssh-allowed <SPACE>
Network Policies Group
cf network-policies
--source <APP>
cf add-network-policy <SOURCE_APP> --destination-app <DEST_APP>
--protocol tcp|udp
--port <PORT>|<START>-<END>
cf remove-network-policy <SOURCE_APP> --destination-app <DEST_APP>
--protocol tcp|udp
--port <PORT>
Admin Group
Users and Roles
cf org-users <ORG>
-a
cf set-org-role <USER> <ORG> <ROLE>
--client
--origin <IDP_ORIGIN>
cf unset-org-role <USER> <ORG> <ROLE>
--client
--origin <IDP_ORIGIN>
cf space-users <ORG> <SPACE>
cf set-space-role <USER> <ORG> <SPACE> <ROLE>
--client
--origin <IDP_ORIGIN>
cf unset-space-role <USER> <ORG> <SPACE> <ROLE>
--client
--origin <IDP_ORIGIN>
cf create-user <USERNAME> [<PASSWORD>]
--origin <IDP_ORIGIN>
cf delete-user <USERNAME>
-f
Quotas
cf org-quotas
cf org-quota <QUOTA_NAME>
cf create-org-quota <QUOTA_NAME>
-m <TOTAL_MEMORY>
-i <INSTANCE_MEMORY>
--reserved-route-ports <N>
-r <ROUTES>
-s <SERVICES>
--allow-paid-service-plans
-a <APP_INSTANCES>
--log-rate-limit <N>
cf update-org-quota <QUOTA_NAME> [same flags as create]
cf set-org-quota <ORG> <QUOTA_NAME>
cf delete-org-quota <QUOTA_NAME>
-f
cf space-quotas
cf space-quota <QUOTA_NAME>
cf create-space-quota <QUOTA_NAME> [same flags as create-org-quota]
cf update-space-quota <QUOTA_NAME> [same flags]
cf set-space-quota <SPACE> <QUOTA_NAME>
cf unset-space-quota <SPACE> <QUOTA_NAME>
cf delete-space-quota <QUOTA_NAME>
-f
Service Brokers
cf service-brokers
cf create-service-broker <NAME> <USER> <PASSWORD> <URL>
--space-scoped
cf update-service-broker <NAME> <USER> <PASSWORD> <URL>
cf delete-service-broker <NAME>
-f
cf rename-service-broker <NAME> <NEW_NAME>
cf service-access
-b <BROKER>
-e <SERVICE_OFFERING>
-o <ORG>
cf enable-service-access <SERVICE_OFFERING>
-b <BROKER>
-p <PLAN>
-o <ORG>
cf disable-service-access <SERVICE_OFFERING>
-b <BROKER>
-p <PLAN>
-o <ORG>
cf purge-service-offering <SERVICE_OFFERING>
-b <BROKER>
-f
cf purge-service-instance <INSTANCE_NAME>
-f
Buildpacks
cf buildpacks
cf create-buildpack <NAME> <PATH_OR_URL> <POSITION>
--disable
cf update-buildpack <NAME>
-p <PATH_OR_URL>
-i <POSITION>
--enable | --disable
--lock | --unlock
-s <STACK>
cf delete-buildpack <NAME>
-f
-s <STACK>
Security Groups
cf security-groups
cf security-group <GROUP_NAME>
cf create-security-group <GROUP_NAME> <RULES_JSON_FILE>
cf update-security-group <GROUP_NAME> <RULES_JSON_FILE>
cf delete-security-group <GROUP_NAME>
-f
cf bind-staging-security-group <GROUP_NAME>
cf unbind-staging-security-group <GROUP_NAME>
cf staging-security-groups
cf bind-running-security-group <GROUP_NAME>
cf unbind-running-security-group <GROUP_NAME>
cf running-security-groups
cf bind-security-group <GROUP_NAME> <ORG> [<SPACE>]
--lifecycle staging|running
cf unbind-security-group <GROUP_NAME> <ORG> <SPACE>
--lifecycle staging|running
-f
Feature Flags
cf feature-flags
cf feature-flag <FLAG_NAME>
cf enable-feature-flag <FLAG_NAME>
cf disable-feature-flag <FLAG_NAME>
Isolation Segments
cf isolation-segments
cf create-isolation-segment <SEGMENT_NAME>
cf delete-isolation-segment <SEGMENT_NAME>
-f
cf enable-org-isolation <ORG> <SEGMENT_NAME>
cf disable-org-isolation <ORG> <SEGMENT_NAME>
cf set-org-default-isolation-segment <ORG> <SEGMENT_NAME>
cf reset-org-default-isolation-segment <ORG>
cf set-space-isolation-segment <SPACE> <SEGMENT_NAME>
cf reset-space-isolation-segment <SPACE>
cf org-isolation-segments <ORG>
Environment Variable Groups
cf staging-environment-variable-group
cf set-staging-environment-variable-group '{"KEY":"value"}'
cf running-environment-variable-group
cf set-running-environment-variable-group '{"KEY":"value"}'
MultiApps Plugin (MTA Deployment)
Installation required: cf install-plugin multiapps or download from GitHub releases
Core MTA Commands
cf deploy [MTA_ARCHIVE_OR_DIRECTORY] [flags]
-e <EXT_DESCRIPTOR>
-f
-m <MODULE>
-r <RESOURCE>
--retries <N>
--skip-testing-phase
--no-start
--abort-on-error
-t <TIMEOUT>
--version-rule LATEST|SAME_HIGHER|ALL
--delete-services
--delete-service-keys
--keep-files
--no-confirm
-i <OPERATION_ID>
-a abort|retry|resume|monitor
--namespace <NS>
--use-namespaces
--strategy blue-green
--skip-idle-start
cf undeploy <MTA_ID>
-f
--delete-services
--delete-service-keys
--delete-service-brokers
-t <TIMEOUT>
cf bg-deploy [MTA_ARCHIVE_OR_DIRECTORY] [flags]
--skip-idle-start
cf mtas
--namespace <NS>
cf mta <MTA_ID>
--namespace <NS>
cf mta-ops
-m <MTA_ID>
--namespace <NS>
cf download-mta-op-logs <OPERATION_ID>
-d <DIRECTORY>
cf purge-mta-config
-f
Typical MTA Deployment Workflow
mbt build
unzip -l mta_archives/*.mtar
cf deploy mta_archives/<mta-id>_<version>.mtar -f
cf deploy . -f
cf apps
cf services
cf logs <APP_NAME> --recent
cf mta-ops
cf deploy -i <OP_ID> -a abort
Advanced / Utility Commands
cf curl <PATH>
-X <METHOD>
-d <DATA>
-H "<HEADER>"
-i
--output <FILE>
cf curl "/v3/apps" -X GET
cf curl "/v3/apps/<guid>/environment_variables" -X PATCH \
-d '{"var":{"MY_VAR":"value"}}'
cf config
--color true|false
--locale <LOCALE>
--trace true|false|<FILE>
cf oauth-token
curl -H "Authorization: $(cf oauth-token)" https://api.cf.eu11.hana.ondemand.com/v3/apps
cf plugins
cf install-plugin <NAME_OR_URL>
-r <REPO>
-f
cf uninstall-plugin <NAME>
cf add-plugin-repo <NAME> <URL>
cf remove-plugin-repo <NAME>
cf list-plugin-repos
cf repo-plugins
-r <REPO>
JSON Output Patterns
CF CLI has no --format json flag. Use cf curl for JSON output:
cf curl "/v3/apps?space_guids=$(cf space <SPACE_NAME> --guid)"
APP_GUID=$(cf app <APP_NAME> --guid)
cf curl "/v3/apps/$APP_GUID/environment_variables"
cf curl "/v3/apps/$APP_GUID/processes" | python3 -m json.tool
cf curl "/v3/service_instances?names=<INSTANCE_NAME>" | \
python3 -c "import sys,json; d=json.load(sys.stdin); print(d['resources'][0]['guid'])"
SPACE_GUID=$(cf space <SPACE_NAME> --guid)
cf curl "/v3/routes?space_guids=$SPACE_GUID"
cf curl "/v3/service_credential_bindings?app_guids=$APP_GUID"
cf curl "/v3/apps/$APP_GUID/processes/web/stats"
See references/curl-api-patterns.md for full CF API v3 patterns.
Common Patterns for Neo → CF Migration
After Deploying an MTA
cf apps
cf services
cf logs <APP_NAME> --recent
cf routes | grep <APP_NAME>
cf env <APP_NAME>
cf logs <APP_NAME>
Diagnosing a 404 After Deployment
cf app <APP_NAME>
cf routes | grep <APP_NAME>
cf logs <APP_NAME> --recent
Diagnosing a Staging Failure
cf logs <APP_NAME> --recent
cf app <APP_NAME>
cf restage <APP_NAME>
Diagnosing Quota / Memory Errors
cf space <SPACE>
cf space-quotas
cf org <ORG>
cf org-quotas
cf scale <APP_NAME> -m 512M -f
Common Issues
| Symptom | Cause | Solution |
|---|
Not logged in | Session expired | cf login |
No org targeted | Missing cf target -o/-s | cf target -o <ORG> -s <SPACE> |
Command 'deploy' not found | MultiApps plugin not installed | cf install-plugin multiapps |
App failed to start | Buildpack error or insufficient memory | cf logs <app> --recent to diagnose |
Routes quota exceeded | Org quota has 0 routes | Assign CF Runtime in BTP Cockpit entitlements — see btp-cli-reference |
Cannot bind service | Service in different space | Service must be in same space or shared |
Staging error: Cannot access defaults field of Properties | maven-war-plugin 2.2 on Java 25 | Pin maven-war-plugin to 3.4.0 in pom.xml |
| 404 on all routes after deployment | WAR deployed with non-root context path | Rename to ROOT.war — set <warName>ROOT</warName> in maven-war-plugin |
MultipleServiceBindingsException at runtime | Same service type bound twice | Ensure only one binding per service type |
cf mta-ops shows stuck operation | Previous deploy didn't clean up | cf deploy -i <op-id> -a abort |
| App restarts repeatedly | Memory limit too low | cf scale <app> -m 1024M -f |
VCAP_SERVICES is empty | Service not bound | cf bind-service <app> <service>, then cf restage <app> |
Scope Boundary: What CF CLI Cannot Do
| Task | Reason | Alternative |
|---|
| Manage BTP subaccounts, entitlements, trust | Account layer, not CF runtime | btp CLI |
| Create CF Runtime quota / assign memory | BTP Cockpit entitlement assignment | btp assign accounts/entitlement |
| Manage XSUAA roles and role collections | BTP security layer | btp CLI |
| Destination service management | No CF CLI support | Destination Service REST API |
| Export JSON from most commands | No --format json flag | cf curl /v3/... |
| Non-interactive auth with client secret (login) | cf login is interactive | cf auth <id> <secret> --client-credentials |
Deploy from Neo neo-app.xml | Different descriptor format | Convert to mtad.yaml first |
| Access Neo platform APIs | Neo is a different platform | neo.sh CLI or Neo REST APIs |
See Also
References