Orchestrate

Report an issue

Something wrong, out of date or unclear? Tell us. Corrections are prioritized over new topics. You don't need to sign in.

0 / 2000

Don't include personal or confidential company details. Reports are reviewed with AI assistance.

Connectivity: Cloud Connector, destinations and private links

Decide how BTP apps and agents reach on-premise and private cloud systems, who owns each piece, and check Calder's design before a call fails in production.

Updated Nov 26, 2026
Foundational layer · 8 min read

The 60-second version

Apps, integration flows and agents on SAP Business Technology Platform (BTP) run in SAP's cloud. Most of the systems they need do not. They sit in a company's data center, or in a private network on a hyperscaler such as AWS or Azure. Connectivity is how the cloud side reaches them without opening the company's firewall to the internet.

Three pieces do the work:

  • The Cloud Connector is a small program the company installs inside its own network. It opens one outbound, encrypted tunnel to BTP. Requests from the cloud travel back down that tunnel, and the Cloud Connector forwards only the ones it has been told to allow.
  • A destination is a named connection setting in a BTP subaccount: which system, which URL, how to log on. Apps ask for a destination by name and never hold the system's address or password themselves.
  • A private link connects selected BTP services to services in the company's own hyperscaler account over the provider's private network, with no Cloud Connector in between.

Connectivity decides what the cloud can reach, as whom, and what happens when a machine in the server room goes down.

Why it matters to the business

Exposure. Every system and every service path the Cloud Connector allows is reachable from BTP. SAP's guidance is to allow only what each app needs, not the whole system. A broad rule set up to "get the pilot working" stays until someone removes it.

Identity. A connection can log on as one technical user for everyone, or carry the real user's identity through to SAP. The second keeps SAP's own authorizations in force. For an AI agent acting for a buyer or a clerk, that difference decides whether the agent can see more than the person can.

Availability. The Cloud Connector is a single point of failure unless it runs as a pair. When it stops, every cloud app that reads S/4HANA through it stops too. SAP recommends a redundant second instance for productive use.

Separation. SAP's guidelines say not to mix productive and non-productive use on one Cloud Connector. A test app that reaches production through a shared connector can change real orders.

Example: Calder Pumpworks, the course's fictional pump maker, runs an order-exception agent, a distributor order-status app and integration flows on BTP. Its S/4HANA system for CP10 runs under RISE with SAP, and its Augsburg company CP20 still runs SAP ECC in its own data center until the July 2027 rollout. Every cloud workload needs a path into one or both. Calder's first draft let the agent's test subaccount read production sales orders. The call worked, which is why nobody noticed.

How SAP does it

As of November 2026, SAP documents connectivity for the BTP multi-cloud environment in its SAP BTP Connectivity documentation:

  • Destination service. Stores connection details and credentials per subaccount, and runs logon flows such as OAuth for the app. Each destination has a proxy type: Internet, OnPremise (through the Cloud Connector) or PrivateLink.
  • Connectivity service. The cloud end of the Cloud Connector's tunnel. Cloud Foundry apps reach on-premise systems through its proxy; Kyma and other Kubernetes workloads use SAP's Connectivity Proxy and Transparent Proxy.
  • Cloud Connector. Software Calder downloads from SAP and runs on its own Windows or Linux machines. It needs only outbound connections on port 443 to SAP's connectivity hosts for each region (Prerequisites). It supports HTTP, HTTPS, RFC and RFC over SNC towards the back end.
  • SAP Private Link service. Lets selected BTP services connect privately to selected services in the customer's own cloud provider account. Which providers, services and regions are covered changes, so check SAP's current Private Link documentation for your landscape.

For integration flows that must run inside the company's network, SAP Integration Suite also offers Edge Integration Cell, covered in the integration platform topic.

Who owns which piece

Connectivity fails at the boundaries between teams. Agree the owners before go-live. The table shows Calder's split; the names are course values.

Piece Lives where Owner at Calder Typical failure
Destination BTP subaccount BTP platform team Wrong URL, location ID or expired password
Connectivity service SAP's cloud SAP Rare; regional incidents
Firewall and proxy rules Calder's network Network team New SAP hosts not allowed outbound
Cloud Connector machines Rockford and Augsburg data centers Infrastructure team Machine down with no shadow
Cloud Connector configuration Same machines Basis team per site Path or system not on the allowlist; certificate expired
Back-end users and roles S/4HANA and ECC Basis and security User mapping missing; role too broad
Network to RISE systems Between Calder and SAP's RISE environment SAP and Calder's network team Unclear who fixes a broken route

Questions to ask

  • Which systems must BTP reach, from which subaccounts, and is each production subaccount connected only to production systems?
  • Where does our Cloud Connector run, who patches it, and does production have a shadow instance?
  • Which service paths and function modules are allowed, and who reviewed them?
  • Does each app log on as a technical user or as the real user, and why?
  • Who renews the Cloud Connector's certificates, and is automatic renewal on?
  • Is the Cloud Connector's audit log set to record everything in production, and who reads it?
  • For our RISE systems: who runs the Cloud Connector and the network path, and is a private link an option on our provider?

Common misconceptions

  • "The Cloud Connector opens our firewall." It makes outbound connections. SAP's prerequisites list only outbound TLS connections on port 443 to its connectivity hosts.
  • "Once connected, BTP can reach the whole network." Access control is an allowlist. The cloud can only call the systems, paths and function modules listed in the Cloud Connector.
  • "One Cloud Connector for everything is simpler." It is, until a test subaccount reaches production. SAP recommends separate Cloud Connectors for productive and non-productive use.
  • "A destination's Check Connection proves the app works." SAP says the check only verifies that a connection is possible. Any HTTP status below 500, including an authorization error, counts as success.
  • "Private links replace the Cloud Connector." They cover selected services in the customer's own cloud provider account. On-premise systems, such as Calder's ECC in Augsburg, still need the Cloud Connector.

Key terms

All course terms, A to Z, in the glossary

  • Cloud Connector: SAP software installed in the customer's network that opens an outbound tunnel to BTP and forwards only allowed requests.
  • Destination: a named connection setting in a subaccount: URL, proxy type, authentication and extra properties.
  • Proxy type: how a destination's traffic travels: Internet, OnPremise or PrivateLink.
  • Location ID: a label that tells BTP which of several Cloud Connectors connected to one subaccount should carry a call.
  • Virtual host: the name the cloud uses for a system; the Cloud Connector maps it to the real internal host, which stays hidden.
  • Principal propagation: passing the logged-on cloud user's identity to the back end, so SAP checks that user's own authorizations.
  • Master and shadow: the main Cloud Connector instance and its standby, which takes over if the main one is unreachable.
  • SAP Private Link service: a private connection from selected BTP services to selected services in the customer's own cloud provider account.

Check yourself

Pick one answer for each question. The explanation appears after you choose.

1What does the Cloud Connector need from the company firewall to let BTP apps call an on-premise system?

Answer: D. The Cloud Connector opens an outbound, TLS-encrypted tunnel to SAP's connectivity hosts on port 443, and requests come back down that tunnel. SAP's prerequisites list only those outbound connections.

2Calder's first draft let the agent's test subaccount read production sales orders through a shared Cloud Connector. Why is that a real risk?

Answer: D. SAP's guidelines say not to mix productive and non-productive use on one Cloud Connector. A test app that reaches production works without any error, so the problem stays hidden until data is wrong.

3An AI agent drafts credit releases for Calder's clerks. Why would an architect prefer principal propagation over one technical user?

Answer: D. With principal propagation the logged-on user's identity reaches SAP, so SAP's own roles decide what the agent can see and do. One technical user would give every clerk the same, usually broader, access.

4The team reports that the destination's Check Connection is green, so the app is ready. What should a project lead reply?

Answer: D. SAP says the check doesn't guarantee the target is operational, and any HTTP status below 500 counts as success, including an authorization error. A test with a real business user is still needed.

5Which question best tests whether production connectivity will survive a machine failure?

Answer: C. Without a shadow, one machine down stops every cloud app that depends on it. SAP recommends high availability for productive use and warns that master and shadow need a reliable network between them.

6Calder wants BTP to reach CP20's ECC system in its Augsburg data center. A partner proposes a private link instead of a Cloud Connector. What is the flaw?

Answer: B. SAP describes Private Link as connecting selected BTP services to selected services in the customer's own IaaS provider accounts. An ECC system in Calder's own data center is on premise, so it needs the Cloud Connector.
Deep layer · 38 min read

Mental model

A call from a BTP app to a private system passes through four allowlists, and each one is owned by a different team:

  1. The destination (BTP platform team): which target, by which proxy type, with which logon.
  2. The tunnel (Connectivity service and the Cloud Connector's subaccount connection): which Cloud Connector serves this subaccount, picked by location ID.
  3. Access control (basis team on the Cloud Connector): which virtual host maps to which real host, and which paths or function modules are allowed.
  4. The back end (S/4HANA or ECC security): which SAP user the call becomes, and what that user's roles allow.

A call succeeds only when all four agree. Most connectivity incidents are one allowlist changed without the others. Most connectivity risks are the opposite: all four agree on something nobody meant, such as a test subaccount mapped to production.

flowchart LR
  A[App or agent<br/>in a subaccount] --> D[Destination<br/>proxy type, auth]
  D --> C[Connectivity service<br/>tunnel by location ID]
  C --> S[Cloud Connector<br/>virtual host, resources]
  S --> B[(S/4HANA or ECC<br/>user and roles)]

How it works

Destinations

A destination is a set of properties in a subaccount or on a Destination service instance. For HTTP destinations, SAP's documentation names three proxy types, set in the ProxyType property, with Internet as the default (HTTP Destinations):

Proxy type Reaches Needs
Internet A public REST or SOAP service Nothing extra
OnPremise A system behind a Cloud Connector Connectivity service, a connected Cloud Connector, access control
PrivateLink A service in your own IaaS account, through SAP Private Link service A private link instance; selected services only

Other destination types are RFC, LDAP, TCP and MAIL. SAP lists many authentication types for HTTP destinations, including NoAuthentication, BasicAuthentication, PrincipalPropagation, OAuth2ClientCredentials, OAuth2SAMLBearerAssertion and OAuth2JWTBearer. Extra properties such as URL.headers.<name> and URL.queries.<name> add a header or query parameter to every call, for clients that support them.

Two design rules follow. Use one destination name per target across all stages (for example S4_ODATA in AI Dev, AI Test and AI Prod), so the same app code runs everywhere and only the subaccount decides the system. And keep credentials only in destinations, never in app code, as secrets and OAuth explains.

The Connectivity service and the proxy

A Cloud Foundry app gets on-premise access by binding a Connectivity service instance. SAP documents that the binding's credentials land in the app's VCAP_SERVICES environment variable and that the app sends its calls through an HTTP proxy, authorized by a token from the Authorization and Trust Management service (XSUAA) or Identity Authentication (Consuming the Connectivity Service). Two documented details cause real incidents:

  • Call the proxy with http://. If the app uses HTTPS towards the proxy, SAP says it gets a 405 response. The tunnel itself is TLS-encrypted, and the Cloud Connector can still use HTTPS towards the back end.
  • Lines are capped at 8,192 bytes. A long OData $filter in the request line returns a 4xx error.

In Kyma and other Kubernetes clusters, SAP's Connectivity Proxy plays the same role, and SAP points to the Transparent Proxy for Kubernetes to apply destination settings for the workload.

The Cloud Connector

The Cloud Connector is a Java program. SAP's prerequisites, as of November 2026: a full JDK (SAP JVM 8, or SapMachine 21 from version 2.17.0 and 25 from 2.19.0), at least 4 GB of memory with 16 GB recommended, and outbound TLS on port 443 to the Connectivity hosts of each region you connect to (Prerequisites). The same page lists new host names under a platform.cloud.sap domain as of 15 November 2026, next to the existing ones. Firewall rules written from an old copy of that list are a quiet risk.

It comes as an installer version (Windows and Linux; runs as a service and keeps its configuration on upgrade) and a portable version that SAP says is for non-productive scenarios only (Installation). On macOS only the portable version exists.

Each Cloud Connector connects to one or more subaccounts. Per subaccount, it has:

  • a location ID. SAP says several Cloud Connectors can serve one subaccount if their location IDs differ. A call names the one it wants (in the destination, or in the SAP-Connectivity-SCC-Location_ID header); without one, it goes to the Cloud Connector connected with no location ID (Consuming the Connectivity Service);
  • a subaccount certificate with limited validity. From version 2.18.0, SAP offers automatic renewal for the multi-cloud environment, switched on per subaccount in both the Cloud Connector and the cockpit; as of November 2026, not in Alibaba Cloud or Google Cloud regions (Renew the Certificate);
  • its own access control list.

Access control

Access control has two levels (Configure Access Control (HTTP)):

System mappings. A virtual host and port, as written in the destination's URL, maps to an internal host and port. The virtual name can be made up and hides the real host from the cloud; the internal one must resolve inside the network. The protocol towards the back end (HTTP or HTTPS) is independent of the cloud side. Options include whether principal propagation is allowed, the principal type (X.509 Certificate), and which host goes in the request header. On save, the Cloud Connector pings the internal host with a HEAD / request.

Resources. A strict allowlist of URL paths. A path matches exactly, ignoring the query string, or, with Path and all sub-paths, any path that starts with the string. That is a string prefix, not a folder rule: /production/accounting with sub-paths also allows /production/accounting-plus-more. End a path with / when you mean a folder.

For RFC (Configure Access Control (RFC)), the protocol is RFC or RFC SNC, the gateway port is 33NN (48NN for SNC), and resources are function module names, exact or by Prefix. Principal propagation over RFC works only with X.509 certificates and an SNC-enabled back end.

Principal propagation

With a destination of authentication type PrincipalPropagation, the Cloud Connector receives the cloud user's identity and, for HTTPS back ends, sends a short-lived X.509 certificate for that user in the SSL_CLIENT_CERT header. The TLS handshake itself uses the Cloud Connector's system certificate. The ABAP system must trust that certificate's issuer and map the short-lived certificate to an SAP user, for example by rule-based certificate mapping. Then S/4HANA checks that user's roles, as grounding on SAP data with authorizations requires.

High availability

The main instance is the master, the standby the shadow. The master pushes its configuration to the shadow; the shadow pings the master and takes over the tunnel if the master is unreachable for a while (High Availability Setup). SAP warns that master and shadow talk outside BTP. A network break between them can cause a temporary double master, with undefined behavior. Put both on a stable network, not in two sites joined by a weak link.

PrivateLink destinations go through SAP Private Link service, which SAP describes as a private connection between selected BTP services and selected services in your own IaaS provider accounts. Use it when the target runs in your own AWS or Azure account and the provider and region are supported; check SAP's current Private Link documentation before you design on it. For systems in your own data center, the Cloud Connector remains the path.

Calder's paths

Calder's design gives each site a production pair and a non-production instance, and lets location IDs pick the site:

flowchart LR
  subgraph BTP[Calder global account]
    AP[AI Prod]
    EP[Ext Prod]
    AT[AI Test]
  end
  AP -->|S4_ODATA @RK| RKP[SCC-RK-P<br/>rkscc01 + rkscc02]
  EP -->|S4_ODATA @RK| RKP
  EP -->|ECC_CERT_ARCHIVE @AU| AUP[SCC-AU-P<br/>auscc01 + auscc02]
  AT -->|S4_ODATA @RK| RKN[SCC-RK-NP<br/>rkscc11]
  RKP --> S4P[(S4P on RISE)]
  RKN --> S4Q[(S4Q on RISE)]
  AUP --> ECP[(ECP in Augsburg)]

The Rockford connectors reach the RISE systems over Calder's private network connection to its RISE environment. That connection is a course assumption: under RISE, which side installs and runs the Cloud Connector and the network path is set by the contract, so confirm it with SAP.

Build it yourself

Before you start: finish Set up your computer for this course. The optional Step 8 uses your BTP trial from Set up for Unit 18, as described in Set up for Unit 21. Everything else runs without an account.

You will put Calder's draft connectivity design into a file, list it, check it against SAP's rules and Calder's, trace every planned call hop by hop the way the Destination service, the Connectivity service and the Cloud Connector would, and write the deliverable unit21/calder_connectivity.md. The draft has five errors and one warning. You fix them in the exercise.

flowchart LR
  I[--init] --> J[calder_connectivity.json<br/>the draft]
  J --> M[--map]
  J --> C[--check<br/>C01-C12]
  J --> T[--trace<br/>hop by hop]
  J --> W[--write]
  W --> R[calder_connectivity.md<br/>the deliverable]

The script talks to no SAP system. It simulates the documented behavior so you can find design errors before anyone installs a Cloud Connector. It doesn't model every Cloud Connector option.

What you need

  • The course folder orchestrate-course with its .venv.
  • No account and no key for Steps 1 to 7. The script uses only Python's built-in modules, so requirements.txt doesn't change.
  • For the optional Step 8: your BTP trial. Free.
  • Time: about 35 minutes.

Step 1: Open your course folder and turn on the virtual environment

  1. Open VS Code, then File > Open Folder and choose orchestrate-course.

  2. Open a terminal with Terminal > New Terminal.

  3. Turn on the virtual environment:

    • Windows (PowerShell):

      .venv\Scripts\Activate.ps1
    • macOS / Linux:

      source .venv/bin/activate
  4. Make the unit21 folder if you don't have it yet:

    • Windows (PowerShell):

      New-Item -ItemType Directory -Force unit21
    • macOS / Linux:

      mkdir -p unit21

You should see (.venv) at the start of the prompt.

Step 2: Create the script

  1. In VS Code, create the file unit21/connectivity_check.py.
  2. Paste the code below and save.
"""Calder's SAP BTP connectivity design: check it, trace a call through it, write it up.

Usage (run from the orchestrate-course folder):
  python unit21/connectivity_check.py --init       write the draft design to unit21/calder_connectivity.json
  python unit21/connectivity_check.py --map        list Cloud Connectors, their subaccounts and destinations
  python unit21/connectivity_check.py --check      check the design against SAP's rules and Calder's
  python unit21/connectivity_check.py --trace      follow every planned call hop by hop
  python unit21/connectivity_check.py --write      write unit21/calder_connectivity.md (the deliverable)

Options:
  --call N                  trace only planned call N (1, 2, ...), as numbered by --trace
  --down HOST               pretend this Cloud Connector machine is down (shows failover)
  --accounts PATH           also compare subaccount names and stages with the account model file
  --file PATH               read another design file in the same shape
  --force                   let --init overwrite an existing design file

Built-in modules only. No account, no network: the script reads a file and simulates what the
Destination service, the Connectivity service and the Cloud Connector would do. Calder Pumpworks
is fictional; host names, location IDs and dates are course labels, and so are rules C08,
C10 and C11 (the others follow SAP's documentation).
"""
import argparse
import datetime as dt
import json
import sys
from pathlib import Path

DESIGN_FILE = Path("unit21/calder_connectivity.json")
REPORT_FILE = Path("unit21/calder_connectivity.md")
STAGE_LETTER = {"dev": "D", "test": "Q", "prod": "P"}   # course rule from the account model topic
CERT_WARN_DAYS = 30                                      # course rule: renew a month ahead
MIN_PREFIX = 5                                           # course rule: no very short RFC prefixes
FENCE = "`" * 3       # a Markdown code fence, written so this file can sit inside one



def draft_design():
    """The platform team's draft of 2026-11-26: four planted errors and one warning."""
    def https(virtual, internal, system, paths, pp=True):
        return {"virtual": virtual, "internal": internal, "protocol": "HTTPS", "system": system,
                "principal_propagation": pp,
                "resources": [{"path": p, "sub_paths": True} for p in paths]}

    so = "/sap/opu/odata/sap/API_SALES_ORDER_SRV"
    rfc_d = {"virtual": "ecd-rfc:3300", "internal": "ecd-app.augsburg.calder.internal:3300",
             "protocol": "RFC SNC", "system": "ECD", "principal_propagation": False,
             "resources": [{"function": "Z_CERT_ARCHIVE_READ", "prefix": False}]}
    rfc_p = dict(rfc_d, virtual="ecp-rfc:3300", internal="ecp-app.augsburg.calder.internal:3300",
                 system="ECP", resources=[{"function": "Z", "prefix": True}])      # planted C10
    return {
        "as_of": "2026-11-26",
        "subaccounts": {
            "Integration Dev": "dev", "Integration Test": "test", "Integration Prod": "prod",
            "AI Dev": "dev", "AI Test": "test", "AI Prod": "prod",
            "Ext Dev": "dev", "Ext Test": "test", "Ext Prod": "prod",
        },
        "systems": {
            "S4D": {"stage": "dev", "where": "RISE (CP10)"},
            "S4Q": {"stage": "test", "where": "RISE (CP10)"},
            "S4P": {"stage": "prod", "where": "RISE (CP10)"},
            "ECD": {"stage": "dev", "where": "Augsburg data center (CP20)"},
            "ECP": {"stage": "prod", "where": "Augsburg data center (CP20)"},
        },
        "mapping_sets": {
            "s4d": [https("s4d-api:443", "s4d-app.calder.internal:44300", "S4D", [so])],
            "s4q": [https("s4q-api:443", "s4q-app.calder.internal:44300", "S4Q", [so])],
            "s4p": [https("s4p-api:443", "s4p-app.calder.internal:44300", "S4P", [so])],
            "ecd": [rfc_d],
            "ecp": [rfc_p],
        },
        "cloud_connectors": [
            {"id": "SCC-RK-NP", "site": "Rockford", "stage": "nonprod", "location_id": "RK",
             "master": "rkscc11", "shadow": None, "audit_level": "All",
             "cert_expires": "2027-06-30", "auto_renewal": True,
             "subaccounts": {"Integration Dev": "s4d", "Integration Test": "s4q", "AI Dev": "s4d",
                             "Ext Dev": "s4d", "Ext Test": "s4q"}},
            {"id": "SCC-RK-P", "site": "Rockford", "stage": "prod", "location_id": "RK",
             "master": "rkscc01", "shadow": "rkscc02", "audit_level": "All",
             "cert_expires": "2027-06-30", "auto_renewal": True,
             "subaccounts": {"Integration Prod": "s4p", "AI Prod": "s4p", "Ext Prod": "s4p",
                             "AI Test": "s4p"}},                                  # planted C06, C08
            {"id": "SCC-AU-NP", "site": "Augsburg", "stage": "nonprod", "location_id": "AU",
             "master": "auscc11", "shadow": None, "audit_level": "Security",
             "cert_expires": "2026-12-12", "auto_renewal": False,                  # planted warning
             "subaccounts": {"Ext Dev": "ecd"}},
            {"id": "SCC-AU-P", "site": "Augsburg", "stage": "prod", "location_id": "AU",
             "master": "auscc01", "shadow": "auscc02", "audit_level": "All",
             "cert_expires": "2027-06-30", "auto_renewal": True,
             "subaccounts": {"Ext Prod": "ecp"}},
        ],
        "destinations": [
            {"subaccount": "AI Dev", "name": "S4_ODATA", "type": "HTTP", "proxy": "OnPremise",
             "url": "http://s4d-api:443", "auth": "PrincipalPropagation", "location_id": "RK"},
            {"subaccount": "AI Test", "name": "S4_ODATA", "type": "HTTP", "proxy": "OnPremise",
             "url": "http://s4p-api:443", "auth": "PrincipalPropagation", "location_id": "RK"},
            {"subaccount": "AI Prod", "name": "S4_ODATA", "type": "HTTP", "proxy": "OnPremise",
             "url": "http://s4p-api:443", "auth": "PrincipalPropagation",
             "location_id": "RK1"},                                               # planted C01
            {"subaccount": "Ext Test", "name": "S4_ODATA", "type": "HTTP", "proxy": "OnPremise",
             "url": "https://s4q-api:443", "auth": "PrincipalPropagation",
             "location_id": "RK"},                                                # planted C04
            {"subaccount": "Ext Prod", "name": "S4_ODATA", "type": "HTTP", "proxy": "OnPremise",
             "url": "http://s4p-api:443", "auth": "BasicAuthentication", "location_id": "RK"},
            {"subaccount": "Ext Prod", "name": "ECC_CERT_ARCHIVE", "type": "RFC", "proxy": "OnPremise",
             "url": "ecp-rfc:3300", "auth": "BasicAuthentication", "location_id": "AU"},
            {"subaccount": "AI Prod", "name": "AI_CORE", "type": "HTTP", "proxy": "Internet",
             "url": "https://ai-core.example/v2",
             "auth": "OAuth2ClientCredentials", "location_id": ""},
        ],
        "calls": [
            {"who": "order-exception agent", "subaccount": "AI Prod", "destination": "S4_ODATA",
             "resource": so + "/A_SalesOrder"},
            {"who": "order-exception agent (test)", "subaccount": "AI Test",
             "destination": "S4_ODATA", "resource": so + "/A_SalesOrder"},
            {"who": "distributor order-status app (test)", "subaccount": "Ext Test",
             "destination": "S4_ODATA", "resource": so + "/A_SalesOrder"},
            {"who": "distributor order-status app", "subaccount": "Ext Prod",
             "destination": "S4_ODATA", "resource": so + "/A_SalesOrder"},
            {"who": "test certificate archive", "subaccount": "Ext Prod",
             "destination": "ECC_CERT_ARCHIVE", "resource": "Z_CERT_ARCHIVE_READ"},
        ],
    }


# ---------------------------------------------------------------- loading and helpers

def load(path):
    if not path.exists():
        sys.exit(f"No design file {path}. Run: python unit21/connectivity_check.py --init")
    try:
        d = json.loads(path.read_text(encoding="utf-8"))
    except json.JSONDecodeError as e:
        sys.exit(f"{path} is not valid JSON (line {e.lineno}, column {e.colno}): {e.msg}")
    for c in d["cloud_connectors"]:
        for sa, ms in c["subaccounts"].items():
            if sa not in d["subaccounts"]:
                sys.exit(f"{c['id']}: subaccount '{sa}' is not in the 'subaccounts' list")
            if ms not in d["mapping_sets"]:
                sys.exit(f"{c['id']}: mapping set '{ms}' is not in 'mapping_sets'")
    for x in d["destinations"]:
        if x["subaccount"] not in d["subaccounts"]:
            sys.exit(f"Destination {x['name']}: subaccount '{x['subaccount']}' is not in the list")
    return d


def host_port(url):
    """'http://s4p-api:443/x' -> ('http', 's4p-api:443'); 'ecp-rfc:3300' -> ('', 'ecp-rfc:3300')."""
    scheme, sep, rest = url.partition("://")
    if not sep:
        return "", url
    return scheme.lower(), rest.split("/", 1)[0]


def connectors_for(d, subaccount, location_id, down=()):
    """Cloud Connectors connected to the subaccount with this location ID, and their live host."""
    out = []
    for c in d["cloud_connectors"]:
        if subaccount in c["subaccounts"] and c["location_id"] == location_id:
            live = c["master"] if c["master"] not in down else (
                c["shadow"] if c["shadow"] and c["shadow"] not in down else None)
            out.append((c, live))
    return out


def find_destination(d, subaccount, name):
    for x in d["destinations"]:
        if x["subaccount"] == subaccount and x["name"] == name:
            return x
    return None


def resource_allowed(mapping, resource):
    """SAP's rule: exact path (query ignored), or 'starts with' when sub-paths or prefix is set."""
    path = resource.split("?", 1)[0]
    for r in mapping["resources"]:
        if "path" in r:
            if path == r["path"] or (r["sub_paths"] and path.startswith(r["path"])):
                return r
        else:
            if path == r["function"] or (r["prefix"] and path.startswith(r["function"])):
                return r
    return None


# ---------------------------------------------------------------- trace one call

def trace(d, call, down=()):
    """Return (ok, lines). Messages in quotes paraphrase SAP's documented errors."""
    lines = [f"{call['who']}: {call['subaccount']} -> {call['destination']} -> {call['resource']}"]
    x = find_destination(d, call["subaccount"], call["destination"])
    if not x:
        return False, lines + [f"  1 Destination service: no destination '{call['destination']}' "
                               f"in {call['subaccount']}  FAIL"]
    loc = x.get("location_id", "")
    lines.append(f"  1 Destination service: {x['type']}, {x['proxy']}, {x['auth']}"
                 + (f", location ID '{loc}'" if x["proxy"] == "OnPremise" else ""))
    if x["proxy"] != "OnPremise":
        return True, lines + ["  2 Direct call over the Internet; no Cloud Connector involved  OK"]
    scheme, hp = host_port(x["url"])
    if x["type"] == "HTTP" and scheme == "https":
        return False, lines + ["  2 Connectivity proxy: HTTPS sent to the proxy; SAP answers 405. "
                               "Use http:// in an OnPremise destination (the tunnel is TLS anyway)  FAIL"]
    found = connectors_for(d, call["subaccount"], loc, down)
    if not found:
        return False, lines + [f"  2 Connectivity service: 'no Cloud Connector for your subaccount' "
                               f"with location ID '{loc}' (HTTP 503)  FAIL"]
    c, live = found[0]
    if live is None:
        return False, lines + [f"  2 Connectivity service: {c['id']} is down and has no live shadow; "
                               "'Cloud Connector is not connected to the subaccount'  FAIL"]
    role = "master" if live == c["master"] else "shadow, took over"
    lines.append(f"  2 Tunnel to {c['id']} at {c['site']} ({live}, {role})")
    mappings = d["mapping_sets"][c["subaccounts"][call["subaccount"]]]
    m = next((m for m in mappings if m["virtual"] == hp), None)
    if not m:
        return False, lines + [f"  3 Access control: '{hp}' is not in the list of defined system "
                               "mappings  FAIL"]
    lines.append(f"  3 Access control: {hp} -> {m['internal']} ({m['protocol']})")
    r = resource_allowed(m, call["resource"])
    if not r:
        return False, lines + [f"  4 Resources: '{call['resource']}' is not accessible in the "
                               "Cloud Connector  FAIL"]
    rule = (f"{r['path']} (path and all sub-paths)" if "path" in r and r["sub_paths"]
            else f"{r.get('path') or r['function']} ({'prefix' if r.get('prefix') else 'exact'})")
    lines.append(f"  4 Resources: allowed by {rule}")
    if x["auth"] == "PrincipalPropagation":
        if not m["principal_propagation"]:
            return False, lines + ["  5 Principal propagation is not allowed on this mapping  FAIL"]
        lines.append(f"  5 {m['system']}: the user arrives as a short-lived X.509 certificate "
                     "and is mapped to an SAP user")
    else:
        lines.append(f"  5 {m['system']}: logs on with the destination's {x['auth']} user")
    stage = d["subaccounts"][call["subaccount"]]
    sys_stage = d["systems"].get(m["system"], {}).get("stage")
    if sys_stage != stage:
        return False, lines + [f"  6 Reached {m['system']} ({sys_stage}) from a {stage} "
                               "subaccount: the call works, which is the problem  FAIL"]
    return True, lines + ["  OK"]


# ---------------------------------------------------------------- the checks

def check(d, accounts=None):
    errors, warnings = [], []
    today = dt.date.fromisoformat(d["as_of"])

    for x in d["destinations"]:
        who = f"{x['subaccount']}/{x['name']}"
        if x["proxy"] != "OnPremise":
            continue
        # C01 a connector with this location ID is connected to the subaccount (SAP behavior)
        if not connectors_for(d, x["subaccount"], x.get("location_id", "")):
            have = sorted({c["location_id"] or "(empty)" for c in d["cloud_connectors"]
                           if x["subaccount"] in c["subaccounts"]})
            errors.append(("C01", who, f"no Cloud Connector with location ID "
                           f"'{x.get('location_id', '')}' is connected to {x['subaccount']} "
                           f"(connected: {', '.join(have) or 'none'})"))
            continue
        # C02 the destination's virtual host and port is mapped on that connector
        c = connectors_for(d, x["subaccount"], x.get("location_id", ""))[0][0]
        scheme, hp = host_port(x["url"])
        mappings = d["mapping_sets"][c["subaccounts"][x["subaccount"]]]
        m = next((m for m in mappings if m["virtual"] == hp), None)
        if not m:
            errors.append(("C02", who, f"virtual host '{hp}' is not mapped on {c['id']} "
                           f"for {x['subaccount']}"))
        # C03 principal propagation is allowed on the mapping (and RFC needs SNC)
        if m and x["auth"] == "PrincipalPropagation":
            if not m["principal_propagation"]:
                errors.append(("C03", who, f"PrincipalPropagation, but {c['id']}'s mapping "
                               f"{hp} doesn't allow principal propagation"))
            if x["type"] == "RFC" and m["protocol"] != "RFC SNC":
                errors.append(("C03", who, "principal propagation over RFC needs RFC SNC"))
        # C04 OnPremise HTTP destinations use http:// towards the proxy (SAP: HTTPS gives 405)
        if x["type"] == "HTTP" and scheme == "https":
            errors.append(("C04", who, "OnPremise HTTP destination with https://; the "
                           "Connectivity service answers 405. Use http:// and set HTTPS "
                           "towards the back end in the Cloud Connector"))

    # C05 location IDs are unique per subaccount (SAP rule)
    for sa in d["subaccounts"]:
        seen = {}
        for c in d["cloud_connectors"]:
            if sa in c["subaccounts"]:
                if c["location_id"] in seen:
                    errors.append(("C05", sa, f"{seen[c['location_id']]} and {c['id']} share "
                                   f"location ID '{c['location_id']}'"))
                seen[c["location_id"]] = c["id"]

    for c in d["cloud_connectors"]:
        stages = {d["subaccounts"][sa] for sa in c["subaccounts"]}
        # C06 don't mix productive and non-productive use on one Cloud Connector (SAP guideline)
        if c["stage"] == "prod" and stages - {"prod"}:
            errors.append(("C06", c["id"], "production Cloud Connector also serves "
                           + ", ".join(sorted(sa for sa in c["subaccounts"]
                                              if d["subaccounts"][sa] != "prod"))))
        if c["stage"] == "nonprod" and "prod" in stages:
            errors.append(("C06", c["id"], "non-production Cloud Connector serves a production subaccount"))
        # C07 production Cloud Connectors run with a shadow instance (SAP recommendation)
        if c["stage"] == "prod" and not c["shadow"]:
            errors.append(("C07", c["id"], "production Cloud Connector without a shadow instance"))
        # C08 every mapping reaches a system of the subaccount's own stage (course rule)
        for sa, ms in c["subaccounts"].items():
            for m in d["mapping_sets"][ms]:
                sys_stage = d["systems"].get(m["system"], {}).get("stage")
                if sys_stage != d["subaccounts"][sa]:
                    errors.append(("C08", f"{c['id']}/{sa}", f"{d['subaccounts'][sa]} subaccount "
                                   f"mapped to {m['system']} ({sys_stage})"))
        # C09 audit level All on production (SAP guideline)
        if c["stage"] == "prod" and c["audit_level"] != "All":
            errors.append(("C09", c["id"], f"audit level '{c['audit_level']}'; set it to All"))
        # C11 subaccount certificate renewal (course rule on SAP's automatic renewal)
        days = (dt.date.fromisoformat(c["cert_expires"]) - today).days
        if days < CERT_WARN_DAYS and not c["auto_renewal"]:
            warnings.append(("C11", c["id"], f"subaccount certificate expires in {days} days "
                             f"({c['cert_expires']}) and automatic renewal is off"))

    # C10 resources: no whole system, no short RFC prefixes (course rule on SAP's guideline)
    for name, ms in d["mapping_sets"].items():
        for m in ms:
            for r in m["resources"]:
                if "path" in r and r["path"] == "/" and r["sub_paths"]:
                    errors.append(("C10", f"{name}/{m['virtual']}", "'/' with all sub-paths "
                                   "exposes the whole system"))
                if "function" in r and r["prefix"] and len(r["function"]) < MIN_PREFIX:
                    errors.append(("C10", f"{name}/{m['virtual']}", f"function prefix "
                                   f"'{r['function']}' allows every module starting with it"))
            # C12 the hop from Cloud Connector to the back end is encrypted (SAP guideline)
            if m["protocol"] in ("HTTP", "RFC"):
                warnings.append(("C12", f"{name}/{m['virtual']}", f"{m['protocol']} to the back "
                                 "end is unencrypted; use HTTPS or RFC SNC"))

    # Optional: compare with the account model topic's file
    if accounts:
        names = {n["name"]: n.get("stage") for n in accounts["nodes"] if n["type"] == "subaccount"}
        for sa, st in d["subaccounts"].items():
            if sa not in names:
                errors.append(("A01", sa, "not a subaccount in the account model"))
            elif names[sa] != st:
                errors.append(("A01", sa, f"stage {st} here, {names[sa]} in the account model"))
    return errors, warnings


# ---------------------------------------------------------------- views and report

def show_map(d):
    out = []
    for c in d["cloud_connectors"]:
        hosts = c["master"] + (f" + shadow {c['shadow']}" if c["shadow"] else ", no shadow")
        out.append(f"{c['id']}  {c['site']}, {c['stage']}, location ID '{c['location_id']}', {hosts}")
        for sa, ms in c["subaccounts"].items():
            targets = ", ".join(f"{m['virtual']}->{m['system']}" for m in d["mapping_sets"][ms])
            out.append(f"    {sa:<17} {targets}")
    out.append("")
    out.append("Destinations:")
    for x in d["destinations"]:
        loc = f" @{x['location_id']}" if x["proxy"] == "OnPremise" else ""
        out.append(f"    {x['subaccount']:<17} {x['name']:<17} {x['type']:<5} {x['proxy']:<10}"
                   f"{x['auth']:<24}{x['url']}{loc}")
    return "\n".join(out)


def run_traces(d, only=None, down=()):
    lines, ok_n = [], 0
    for i, call in enumerate(d["calls"], start=1):
        if only and i != only:
            continue
        ok, t = trace(d, call, down)
        ok_n += ok
        t[0] = f"[{i}] {t[0]}"
        lines += t + [""]
    total = 1 if only else len(d["calls"])
    lines.append(f"{ok_n} of {total} call(s) OK")
    return "\n".join(lines), ok_n, total


OWNERS = """| Piece | Who owns it at Calder (course values) | What they do |
| --- | --- | --- |
| Destinations in each subaccount | BTP platform team | Create, review and rotate credentials; one name per target in every stage |
| Cloud Connector machines and OS | Infrastructure team at each site | Patch, back up, encrypt disks, keep master and shadow on a stable network |
| Cloud Connector configuration | Basis team at each site | Access control, location IDs, certificates, audit log, upgrades in non-production first |
| Firewall and proxy rules | Network team | Outbound 443 to SAP's Connectivity hosts for the region, kept current |
| Back-end users and certificate mapping | S/4HANA and ECC basis | Trust the Cloud Connector, map certificates to users, keep roles narrow |
| RISE network connection | SAP under the RISE contract, with Calder's network team | Confirm in the contract which side runs what |
"""


def write_report(d, path, errors, warnings):
    traces, ok_n, total = run_traces(d)
    crow = []
    for c in d["cloud_connectors"]:
        crow.append(f"| {c['id']} | {c['site']} | {c['stage']} | `{c['location_id']}` | {c['master']} | "
                    f"{c['shadow'] or 'none'} | {c['audit_level']} | {c['cert_expires']}"
                    f"{' (auto)' if c['auto_renewal'] else ''} | {', '.join(c['subaccounts'])} |")
    drow = [f"| {x['subaccount']} | {x['name']} | {x['type']} | {x['proxy']} | {x['auth']} | "
            f"`{x['url']}` | {x.get('location_id') or ''} |" for x in d["destinations"]]
    errs = "\n".join(f"- {c} {w}: {t}" for c, w, t in errors) or "- none"
    warns = "\n".join(f"- {c} {w}: {t}" for c, w, t in warnings) or "- none"
    nl = "\n"
    text = f"""# Calder Pumpworks: SAP BTP connectivity design

As of {d['as_of']}. Calder Pumpworks is a fictional company; every host, ID and date is a course value.

## Cloud Connectors

| ID | Site | Stage | Location ID | Master | Shadow | Audit | Certificate | Subaccounts |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
{nl.join(crow)}

## Destinations

| Subaccount | Name | Type | Proxy type | Authentication | URL | Location ID |
| --- | --- | --- | --- | --- | --- | --- |
{nl.join(drow)}

## Planned calls, traced

{FENCE}text
{traces}
{FENCE}

## Check result

Errors:

{errs}

Warnings:

{warns}

## Who owns each piece

{OWNERS}
## Decision record

- **Context:** (which systems BTP must reach, from which subaccounts, and why now)
- **Options:** (a) one Cloud Connector for every stage; (b) one per site and stage, production with a shadow; (c) Private Link or Edge Integration Cell for the RISE systems
- **Decision:** (your choice and reason)
- **Consequences:** (what gets easier, what gets harder, who runs what)
"""
    path.write_text(text, encoding="utf-8")
    return ok_n, total


# ---------------------------------------------------------------- main

def main():
    p = argparse.ArgumentParser(description="Calder's SAP BTP connectivity design")
    for flag in ("--init", "--force", "--map", "--check", "--trace", "--write"):
        p.add_argument(flag, action="store_true")
    p.add_argument("--call", type=int)
    p.add_argument("--down", action="append", default=[])
    p.add_argument("--accounts")
    p.add_argument("--file", default=str(DESIGN_FILE))
    a = p.parse_args()
    path = Path(a.file)

    if a.init:
        if path.exists() and not a.force:
            sys.exit(f"{path} exists; your edits would be lost. Add --force to start over.")
        path.parent.mkdir(parents=True, exist_ok=True)
        path.write_text(json.dumps(draft_design(), indent=2) + "\n", encoding="utf-8")
        dd = draft_design()
        print(f"Wrote {path}: {len(dd['cloud_connectors'])} Cloud Connectors, "
              f"{len(dd['destinations'])} destinations, {len(dd['calls'])} planned calls.")
        return 0
    if not any([a.map, a.check, a.trace, a.write]):
        p.print_help()
        return 0

    d = load(path)
    accounts = None
    if a.accounts:
        ap = Path(a.accounts)
        if not ap.exists():
            sys.exit(f"No account model file {ap}; run the account model topic's --init first, "
                     "or leave out --accounts")
        accounts = json.loads(ap.read_text(encoding="utf-8"))
    code = 0
    if a.map:
        print(show_map(d))
    if a.trace:
        if a.call and not 1 <= a.call <= len(d["calls"]):
            sys.exit(f"--call: choose 1 to {len(d['calls'])}")
        text, ok_n, total = run_traces(d, a.call, a.down)
        print(text)
        code = max(code, 0 if ok_n == total else 1)
    errors, warnings = check(d, accounts)
    if a.check:
        print(f"Checked {len(d['cloud_connectors'])} Cloud Connectors, "
              f"{len(d['destinations'])} destinations.")
        for c, w, t in errors:
            print(f"ERROR {c} {w}: {t}")
        for c, w, t in warnings:
            print(f"WARN  {c} {w}: {t}")
        print(f"{len(errors)} error(s), {len(warnings)} warning(s)")
        code = max(code, 1 if errors else 0)
    if a.write:
        out = REPORT_FILE if path == DESIGN_FILE else path.with_suffix(".md")
        ok_n, total = write_report(d, out, errors, warnings)
        print(f"Wrote {out} ({ok_n} of {total} planned calls OK)")
    return code


if __name__ == "__main__":
    sys.exit(main())

Step 3: Write the draft design

  1. Run:

    python unit21/connectivity_check.py --init
  2. You should see:

    Wrote unit21/calder_connectivity.json: 4 Cloud Connectors, 7 destinations, 5 planned calls.
  3. Open unit21/calder_connectivity.json. It has six parts: subaccounts with their stage, systems (S/4HANA S4D, S4Q, S4P on RISE and ECC ECD, ECP in Augsburg), mapping_sets (the access control lists), cloud_connectors, destinations and the planned calls.

A mapping set stands for the access control of one subaccount on a Cloud Connector. Several subaccounts can share one set here, which is a simplification: in the real Cloud Connector each subaccount has its own list, and SAP offers a copy function for subaccount configurations.

Step 4: List the design

  1. Run:

    python unit21/connectivity_check.py --map
  2. The first lines show each Cloud Connector with its subaccounts and mapped systems:

    SCC-RK-NP  Rockford, nonprod, location ID 'RK', rkscc11, no shadow
        Integration Dev   s4d-api:443->S4D
        Integration Test  s4q-api:443->S4Q
        AI Dev            s4d-api:443->S4D
        Ext Dev           s4d-api:443->S4D
        Ext Test          s4q-api:443->S4Q
    SCC-RK-P  Rockford, prod, location ID 'RK', rkscc01 + shadow rkscc02
        Integration Prod  s4p-api:443->S4P
        AI Prod           s4p-api:443->S4P
        Ext Prod          s4p-api:443->S4P
        AI Test           s4p-api:443->S4P
  3. Look at the last line. AI Test is a test subaccount, connected to the production Cloud Connector and mapped to S4P. Then look at the destinations at the end of the output: AI Prod's S4_ODATA uses location ID RK1, and Ext Test's uses https://.

Step 5: Check the design

  1. Run:

    python unit21/connectivity_check.py --check
  2. You should see:

    Checked 4 Cloud Connectors, 7 destinations.
    ERROR C01 AI Prod/S4_ODATA: no Cloud Connector with location ID 'RK1' is connected to AI Prod (connected: RK)
    ERROR C04 Ext Test/S4_ODATA: OnPremise HTTP destination with https://; the Connectivity service answers 405. Use http:// and set HTTPS towards the back end in the Cloud Connector
    ERROR C06 SCC-RK-P: production Cloud Connector also serves AI Test
    ERROR C08 SCC-RK-P/AI Test: test subaccount mapped to S4P (prod)
    ERROR C10 ecp/ecp-rfc:3300: function prefix 'Z' allows every module starting with it
    WARN  C11 SCC-AU-NP: subaccount certificate expires in 16 days (2026-12-12) and automatic renewal is off
    5 error(s), 1 warning(s)
  3. The exit code is 1 because there are errors. That is expected before the exercise.

The rules:

Code Rule Source
C01 A Cloud Connector with the destination's location ID serves the subaccount SAP: location ID picks the Cloud Connector
C02 The destination's virtual host and port is mapped SAP: access control
C03 Principal propagation is allowed on the mapping; over RFC only with SNC SAP: access control (HTTP, RFC)
C04 OnPremise HTTP destinations call the proxy with http:// SAP: HTTPS to the proxy returns 405
C05 Location IDs differ between the Cloud Connectors of one subaccount SAP: consuming the Connectivity service
C06 No mixing of productive and non-productive use on one Cloud Connector SAP: security guidelines
C07 Production Cloud Connectors have a shadow SAP: security guidelines, high availability
C08 Each mapping reaches a system of the subaccount's own stage Course rule from the account model topic
C09 Production audit level is All SAP: security guidelines
C10 No / with all sub-paths; no RFC prefix shorter than five characters Course rule on SAP's "don't expose the complete system"
C11 Certificates expiring within 30 days need automatic renewal on Course rule on SAP's renewal options
C12 The hop to the back end uses HTTPS or RFC SNC (warning) SAP: security guidelines

Step 6: Trace the planned calls

  1. Run:

    python unit21/connectivity_check.py --trace
  2. Each call shows its hops and where it stops. The second call is the one that matters most:

    [2] order-exception agent (test): AI Test -> S4_ODATA -> /sap/opu/odata/sap/API_SALES_ORDER_SRV/A_SalesOrder
      1 Destination service: HTTP, OnPremise, PrincipalPropagation, location ID 'RK'
      2 Tunnel to SCC-RK-P at Rockford (rkscc01, master)
      3 Access control: s4p-api:443 -> s4p-app.calder.internal:44300 (HTTPS)
      4 Resources: allowed by /sap/opu/odata/sap/API_SALES_ORDER_SRV (path and all sub-paths)
      5 S4P: the user arrives as a short-lived X.509 certificate and is mapped to an SAP user
      6 Reached S4P (prod) from a test subaccount: the call works, which is the problem  FAIL
  3. The run ends with 2 of 5 call(s) OK. The order-exception agent in AI Prod fails at hop 2 with a 503 ("no Cloud Connector for your subaccount"), and Ext Test fails with a 405.

  4. Trace one call with its production machine down, to see the shadow take over:

    python unit21/connectivity_check.py --trace --call 4 --down rkscc01

    Hop 2 now reads Tunnel to SCC-RK-P at Rockford (rkscc02, shadow, took over) and the call is OK.

  5. Take both Augsburg production machines down:

    python unit21/connectivity_check.py --trace --call 5 --down auscc01 --down auscc02

    The certificate archive fails at hop 2. A shadow protects against one machine, not against the site.

Step 7: Write the deliverable

  1. Run:

    python unit21/connectivity_check.py --write
  2. You should see Wrote unit21/calder_connectivity.md (2 of 5 planned calls OK). Open it: Cloud Connectors, destinations, every trace, the check result, the owner table and an empty decision record.

  3. If you did the exercise in the account model topic, compare subaccount names and stages with it:

    python unit21/connectivity_check.py --check --accounts unit21/calder_account_model.json

    Any A01 line names a subaccount that differs between the two files.

Step 8 (optional): Create and check a destination in your trial

This step uses your free trial and an Internet destination, because a trial has no on-premise system to reach.

  1. Open your trial cockpit and go to your subaccount.
  2. In the left menu, choose Connectivity > Destinations.
  3. Choose Create > From Scratch > Create.
  4. Enter the name SAP_API_SANDBOX, type HTTP, proxy type Internet, URL https://sandbox.api.sap.com, authentication NoAuthentication. Choose Create.
  5. Open the new destination and choose Check Connection.
  6. The check reports success even though the sandbox needs an API key for real calls. SAP counts any HTTP status below 500 as success for Internet destinations. That is the misconception from the foundational layer, seen live.
  7. Delete the destination when you're done.

SAP's trial allows a Cloud Connector for up to two on-premise systems (see Set up for Unit 21). Installing one on your laptop is possible with the portable version, which SAP says is for non-productive use only; this topic doesn't require it.

What the code does

Part What it does
draft_design() Calder's draft: 4 Cloud Connectors, 7 destinations, 5 calls, 5 planted errors and a warning
load() Reads the JSON and stops on bad JSON or a subaccount or mapping set that doesn't exist
host_port() Splits a destination URL into scheme and virtual host:port
connectors_for() Finds the Cloud Connector for a subaccount and location ID, and its live machine (master, else shadow)
resource_allowed() SAP's matching rule: exact path, or "starts with" for sub-paths and RFC prefixes
trace() Follows one call through destination, tunnel, access control, resources and back-end logon
check() Rules C01 to C12, plus A01 with --accounts
write_report() Writes the deliverable with the owner table and an empty decision record

If something goes wrong

What you see What it means What to do
python: command not found or 'python' is not recognized Python isn't on the path, or the virtual environment is off Turn on .venv (Step 1); on macOS or Linux try python3
No design file unit21/calder_connectivity.json Step 3 wasn't run, or you're in another folder Run --init from orchestrate-course
... exists; your edits would be lost You ran --init again Keep your file, or add --force to start over
... is not valid JSON (line 52, column 9) An edit left out a comma or quote Open the file at that line; VS Code underlines it
subaccount 'AI Testing' is not in the 'subaccounts' list A name is misspelled (names are case-sensitive) Use the exact name from subaccounts
--call: choose 1 to 5 The call number doesn't exist Run --trace without --call to see the numbers
No account model file ... --accounts points to a missing file Run the account model topic's script, or leave out --accounts
Step 8: Check Connection fails with a network error The trial can't reach the URL, or you mistyped it Check the URL; any status below 500 counts as success
Step 8: you can't open the trial at all Company network or proxy blocks it Try from another network, or skip Step 8

The SAP way

As of November 2026, these are SAP's tools for running connectivity:

  • Destinations editor in the cockpit (Connectivity > Destinations), with Check Connection.
  • Cloud Connectors view in the cockpit (Connectivity > Cloud Connectors): which connectors are connected, their location IDs, the authentication data file for connecting one, and the auto renewal switch.
  • Cloud Connector administration UI, in a browser on the Cloud Connector machine's network: subaccounts, access control, principal propagation trust, high availability, audit log and monitoring.
  • Connectivity service for Cloud Foundry apps, and the Connectivity Proxy and Transparent Proxy for Kyma and Kubernetes.
  • SAP Private Link service for private connections to selected services in your own IaaS accounts.
  • Edge Integration Cell when integration flows themselves must run in your network (integration platform topic).

Licensing: check the Connectivity, Destination and Private Link service plans for your contract and region in SAP Discovery Center before you size a design. The Cloud Connector is downloaded from SAP's development tools page; you provide and pay for the machines it runs on.

Build vs. SAP

Need Use SAP's Decide or build yourself Why
Tunnel to on-premise systems Cloud Connector Where it runs, who operates it Supported, outbound only; no reason to build your own
Connection settings and credentials Destination service Naming standard per stage Apps stay free of hosts and passwords
Private network to your hyperscaler account SAP Private Link service, where supported Whether the target qualifies Coverage varies by provider and service
Checking a design before go-live Nothing ready-made A design file and checks like this topic's Stage mix-ups and broad rules work without errors
Monitoring tunnels and certificates Cloud Connector monitoring and alerting, cockpit view Alert routing to the owning team Expired certificates stop every call
Integration logic close to the systems Edge Integration Cell Which flows must stay on site Same runtime as the cloud, run by you

Architecture view

Where it sits. See Calder's paths in How it works: BTP subaccounts in SAP's cloud, two Cloud Connector pairs and two non-production instances in Calder's Rockford and Augsburg data centers, S/4HANA CP10 on RISE and ECC CP20 on premise.

Non-functional requirements that decide the design

Requirement Typical target (course values) If missed
Separation No non-production subaccount reaches a production system Test runs change real orders
Availability Production pair per site, shadow on the same stable network One reboot stops every cloud app on that site
Exposure Only the API paths and function modules each app uses A new app silently gains access to old rules
Identity User-facing apps and agents propagate the user An agent sees more than the person it acts for
Certificate validity Automatic renewal on, alert 30 days ahead Every tunnel on the subaccount stops on one date
Request size Requests within 8,192 bytes per line Long OData filters fail with 4xx

Integration and identity. Apps resolve a destination by name in their subaccount. The Connectivity service routes the call to the Cloud Connector with the destination's location ID. The Cloud Connector maps the virtual host, checks the path, and opens HTTPS or RFC SNC to the back end. User-facing calls carry the user as a short-lived X.509 certificate that S/4HANA maps to an SAP user; technical calls, such as the distributor app (its users are distributors, not SAP users), log on with the destination's technical user. The APIs themselves are the released ones, here API_SALES_ORDER_SRV, as calling your first SAP API shows.

The decision to record (ADR form from Writing a solution design doc):

  • Context: Nine stage subaccounts must reach S/4HANA on RISE and, until July 2027, ECC in Augsburg. The pilot used one Cloud Connector for everything.
  • Options: (a) one Cloud Connector for all stages and sites; (b) one per site and stage, production as master and shadow, location IDs RK and AU; (c) private links for the RISE systems and Cloud Connectors only for Augsburg.
  • Decision: (b). SAP's guidelines rule out (a). Option (c) depends on SAP confirming support for Calder's RISE provider and region; revisit it when that answer arrives.
  • Consequences: Six machines instead of one. Every subaccount's destinations carry a location ID. The Augsburg connectors retire after the July 2027 rollout, with their destinations.

What a design review will ask

  1. Can any non-production subaccount reach a production system, and how would you detect it?
  2. Who is called at 02:00 when the Rockford production Cloud Connector stops, and what fails over?
  3. Which paths and function modules are allowed, and when were they last reviewed?
  4. Which apps propagate the user, which use a technical user, and why?
  5. For RISE: which party runs which piece of the path, in writing?

Production concerns

  • Security and authorizations. Follow SAP's guidelines: a dedicated machine with disk encryption and an OS audit log; change the initial Administrator password at once; named administrators through LDAP; a trusted certificate for the admin UI; virtual host names; narrow resources; a list of trusted cloud applications allowed to use the tunnel (Security Guidelines). For BTP roles around destinations and connectors, see the BTP security model.
  • Evaluation. Keep the design file in Git and run --check on every change. After go-live, compare it with the Cloud Connector's real configuration at each review.
  • Cost. Six small machines, their operating system support, and the people who run them. Private Link service is billed separately where used.
  • Operations. Set the audit level to All in production and archive the logs. Upgrade the non-production Cloud Connectors first and production a week later. Keep firewall rules in step with SAP's host list for your regions.
  • Clean core. Expose released APIs and released RFC-enabled modules, not custom modules that read tables. A Cloud Connector rule for a custom module is a clean core finding waiting to happen.

Where AI fits

AI changes four things here.

  • An agent is one more consumer. It reaches S/4HANA through the same destinations as any app. Give each agent its own destination names and the narrowest resources, so its access can be reviewed and removed on its own.
  • Identity matters more. An agent acting for a user should propagate that user, so SAP's roles stay the limit. A technical user turns every agent into a superuser for its scope. Roles and authorization design covers the SAP side.
  • Agents fail in new ways. Generated OData queries can be long, and the 8,192-byte line limit returns a 4xx the agent may misread as "no data". Log the status code, not only the answer.
  • AI can help administer it. SAP's MCP server for BTP administration includes connectivity tools, and it acts with the full scope of the signed-in user, as the account model topic explains. Connect it with a narrow identity, never as a Cloud Connector or subaccount administrator by default.

Pitfalls

  • Test mapped to production. The call works, so nobody notices.
  • https:// in an OnPremise destination. A 405, while the real protection is already the TLS tunnel.
  • Location ID typos. RK1 instead of RK gives a 503 that looks like an outage.
  • Prefix rules that are too wide. Z as an RFC prefix, or a path without a trailing /, allows more than intended.
  • A shadow in another site. Master and shadow need a stable network; a weak link can cause a double master.
  • One Cloud Connector for every stage. Simple until a change for test breaks production.
  • Expired certificates. Every tunnel on that subaccount stops on the same day.
  • Trusting Check Connection. A 401 counts as success.
  • Old firewall lists. SAP adds host names; a rule copied years ago misses them.

Exercise

Fix the draft's five errors and its warning, add the invoice triage agent's purchase order calls, and record the decision.

  1. Open unit21/calder_connectivity.json in VS Code.

  2. In the destination with "subaccount": "AI Prod" and "name": "S4_ODATA", change "location_id": "RK1" to "location_id": "RK".

  3. In the destination for "subaccount": "Ext Test", change "url": "https://s4q-api:443" to "url": "http://s4q-api:443".

  4. Move AI Test to non-production. In SCC-RK-P's subaccounts, delete the line "AI Test": "s4p" (and the comma before it). In SCC-RK-NP's subaccounts, add "AI Test": "s4q". In AI Test's destination, change the URL to "http://s4q-api:443".

  5. In mapping_sets → ecp, replace the resource {"function": "Z", "prefix": true} with {"function": "Z_CERT_ARCHIVE_READ", "prefix": false}.

  6. In SCC-AU-NP, change "auto_renewal": false to "auto_renewal": true.

  7. The invoice triage agent in AI Prod reads purchase orders. In mapping_sets → s4p, add a second resource after the sales order one:

    {"path": "/sap/opu/odata/sap/API_PURCHASEORDER_PROCESS_SRV", "sub_paths": true}

    Then add a call at the end of calls:

    {"who": "invoice triage agent", "subaccount": "AI Prod", "destination": "S4_ODATA",
     "resource": "/sap/opu/odata/sap/API_PURCHASEORDER_PROCESS_SRV/A_PurchaseOrder"}
  8. Run python unit21/connectivity_check.py --check. It should end with 0 error(s), 0 warning(s).

  9. Run python unit21/connectivity_check.py --trace. It should end with 6 of 6 call(s) OK.

  10. Try a mistake on purpose: set SCC-RK-P's "shadow" to null and run --check. You should see C07. Put "rkscc02" back.

  11. Run --write, open unit21/calder_connectivity.md, and fill in the Decision record in your own words. Under the owner table, add one line saying who you would call first if call 1 failed with a 503, and why.

  12. Commit the script, the design and the deliverable with Git.

Done when: --check reports 0 error(s), 0 warning(s) with exit code 0, --trace reports 6 of 6 call(s) OK, and unit21/calder_connectivity.md has a filled-in decision record. Keep the file: the BTP security model topic adds roles to these subaccounts, and the Architect capstone (Unit 32) collects it into Calder's target architecture.

Check yourself

Pick one answer for each question. The explanation appears after you choose.

1Ext Test's destination uses https://s4q-api:443 with proxy type OnPremise. What happens, and what is the fix?

Answer: B. SAP documents that calls to the Connectivity proxy must use HTTP and that HTTPS returns 405. The tunnel is TLS-encrypted anyway, and the Cloud Connector's protocol towards the back end is set independently.

2AI Prod's destination has location ID RK1, but the production Cloud Connector registered with RK. What does the order-exception agent see?

Answer: C. The location ID picks the Cloud Connector. BTP looks for a Cloud Connector connected to that subaccount with exactly that ID; with none, the call fails at the tunnel, before access control or S/4HANA are involved.

3A resource is set to /sap/opu/odata/sap/API_SALES_ORDER_SRV with Path and all sub-paths. Which request does it also allow?

Answer: D. SAP says that with this option the Cloud Connector allows every path that starts with the string. That is a string prefix, so a sibling name with extra characters also matches; end the path with / when you mean a folder.

4Why does --trace mark call 2 (AI Test to S4P) as FAIL when every hop succeeds?

Answer: A. All four allowlists agreed, so a real call would succeed. The course rule C08 and SAP's guideline against mixing productive and non-productive use flag it as a design error precisely because nothing else would.

5The ECC mapping allows RFC function modules by the prefix Z. What is the risk?

Answer: B. With the Prefix option, SAP allows every function module whose name begins with the string. SAP's guidelines say to expose only what the cloud apps need, so allow Z_CERT_ARCHIVE_READ by exact name.

6Calder plans to put the production shadow in Augsburg and the master in Rockford, for site redundancy. What does SAP's high availability documentation warn about?

Answer: A. Master and shadow communicate outside BTP. SAP warns that a communication breakdown can trigger a takeover while the master still runs, and says to choose a stable and reliable network for both instances.

7A buyer's AI agent will draft purchase order changes in S/4HANA. Which destination design fits best?

Answer: C. Principal propagation sends the user as a short-lived X.509 certificate that S/4HANA maps to an SAP user, so the buyer's own authorizations apply. A technical user would give the agent the same access for every buyer.

8Calder's subaccount certificate for the Augsburg non-production connector expires in 16 days and auto renewal is off. What should the basis team do?

Answer: A. SAP offers automatic renewal from version 2.18.0 for the multi-cloud environment, switched on per subaccount on both sides. Manual renewal from the administration UI also works, even after expiry, but the tunnel stops until then.
NextThe BTP security model: users, trust, role collections and audit logsDecide who signs in to SAP BTP through which identity provider, what each role collection lets them do, and check Calder's access design before an auditor does.

Sources

  • Prerequisites (Cloud Connector, SAP BTP Connectivity documentation, SAP-docs on GitHub, read 2026-11-26) — hardware 4 GB RAM minimum, 16 GB recommended; full JDK, SapMachine 21 from 2.17.0 and 25 from 2.19.0; outbound TLS on port 443 to the Connectivity hosts of each region; new hosts under platform.cloud.sap listed as of 15 November 2026; Connectivity Proxy endpoint for Kubernetes
  • Installation (Cloud Connector) — portable and installer versions on Windows and Linux, portable only on macOS; portable versions for non-productive scenarios only and without automatic upgrade; installer runs as a Windows service or Linux daemon and upgrades keep the configuration
  • Configure Access Control (HTTP) — back-end type, protocol to the back end independent of the cloud side, internal host must be real, virtual host can be fake, principal type X.509, host in request header, strict allowlist of URL paths, 'path and all sub-paths' means starts with the string, ping on save via HEAD /
  • Configure Access Control (RFC) — RFC or RFC SNC to the back end; gateway port 33NN, 48NN for SNC; principal propagation over RFC only with X.509 and an SNC-enabled back end; function module allowlist with exact name or Prefix
  • HTTP Destinations (SAP BTP Connectivity) — proxy types Internet, OnPremise and PrivateLink (selected BTP services to selected services in your own IaaS accounts), default Internet; list of authentication types; URL.headers and URL.queries properties; Transparent Proxy for Kubernetes
  • Consuming the Connectivity Service — instance and binding needed; credentials in VCAP_SERVICES; XSUAA or IAS tokens for the proxy; calls to the proxy must use HTTP, HTTPS returns 405, the tunnel is TLS-encrypted; 8,192-byte limit on HTTP lines; several Cloud Connectors per subaccount if their location IDs differ, header SAP-Connectivity-SCC-Location_ID, default the connector without a location ID
  • Security Guidelines (Cloud Connector) — DMZ vs intranet; dedicated, encrypted machine; LDAP named administrators; audit level All in production; high availability for productive use; HTTP, HTTPS, RFC, RFC over SNC; virtual host names; narrow resources; trusted applications; separate Cloud Connectors for productive and non-productive use
  • High Availability Setup (Cloud Connector) — master and shadow; master pushes configuration; shadow takes over when the master is unreachable; master and shadow talk outside BTP, so a network break can cause a temporary double master with undefined behavior
  • Check the Availability of a Destination — Check Connection in the Destinations editor for Internet and OnPremise; below 500 counts as success; error messages for OnPremise destinations (not connected, not in system mappings, resource not accessible, back end not reachable)
  • Renew the Certificate for a Subaccount (Cloud Connector) — subaccount certificates have limited validity; manual renewal; automatic renewal from 2.18.0 for the multi-cloud environment, enabled per subaccount in both the Cloud Connector and the cockpit, not yet on Alibaba Cloud and Google Cloud regions

Sign in to track your progress

We'll email you a one-time sign-in link. No password needed.

or

Tell us a little about you

Optional, every field. It helps us pitch answers to your questions at the right level and decide which topics to write next. It is never shown publicly, and you can change or clear it anytime from the account menu.

SAP areas you work in