agentleFS
SAPSAP/custom-agentic-cookbook/skills/sap-repair-joule-access/SKILL.md

sap-repair-joule-access

Skill9 starsChanged 24 days agoApache-2.0View on GitHub

Diagnose and resolve SAP Joule CLI login, HTTP 401/403, and missing capability deployment access in this Cookbook. Use when `joule list`, `joule compile`, or `joule deploy` fails because the session is logged out or stale, the IAS trust origin is wrong, or the user lacks the Terraform-managed Joule Developer assignment containing `end_user`, `extensibility_developer`, and `capability_admin`.

The file

Show its rules and text

We split this skill into the rules it gives an agent

14 rules. About 0 are common, 10 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈10

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Never drive an interactive Joule or BTP SSO/passcode flow for the user.

    line 13
  2. Distinctive:

    Never log the user out or retry login in a loop.

    line 14
  3. Distinctive:

    Never print, persist, or request client secrets or binding JSON.

    line 15
  4. Distinctive:

    Use read-only checks first.

    line 16
  5. Distinctive:

    Stop if a plan contains unrelated changes, replacements, deletions, or paid service changes.

    line 19
  6. Very specific:

    Run the failing Joule command once and retain its exact output.

    line 24
  7. Very specific:

    Use ./scripts/joule-login.sh --create-binding only when the binding is absent and the user has authorized creating it.

    line 37
  8. Distinctive:

    Verify all of the following:

    line 57
  9. Very specific:

    If all three are correct, do not change Terraform.

    line 65
  10. Distinctive:

    Add the affected IAS user to the managed capability-deployer variable in the existing environment tfvars file:

    line 70
  11. Distinctive:

    Create a saved plan with the same variable files used by the target account, then run the policy check.

    line 90
  12. Very specific:

    After a successful apply, hand off ./scripts/joule-login.sh once so the user receives a fresh token.

    line 107
  13. Distinctive:

    Stop and explain the remaining administrative boundary when:

    line 113
  14. Distinctive:

    Do not claim that Terraform can complete an IAS activation or tenant-specific App2App administration step that the SAP provider does not …

    line 120

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Resolve Joule access

Diagnose the failure before proposing a change. Treat login, authorization, and IAS App2App setup as separate problems.

Guardrails

  • Never drive an interactive Joule or BTP SSO/passcode flow for the user.
  • Never log the user out or retry login in a loop.
  • Never print, persist, or request client secrets or binding JSON.
  • Use read-only checks first. Do not mutate roles directly with the BTP CLI.
  • Repair managed access through Terraform. Show the plan and obtain approval before applying it to a live subaccount.
  • Stop if a plan contains unrelated changes, replacements, deletions, or paid service changes.

Diagnose once

Run the failing Joule command once and retain its exact output. Use joule -w status only to identify the current login and user.

Classify the result:

  • Logged out, AUTH_LOAD_FAILED, or no current user: hand off this command and stop so the user can complete the passcode flow in their own terminal:

    cd infra/btp
    ./scripts/joule-login.sh

    Use ./scripts/joule-login.sh --create-binding only when the binding is absent and the user has authorized creating it.

  • HTTP 401/403 after a previously valid login: inspect the role collection and assignment below. A token issued before a role change can remain stale.
  • Any other error: report it as a non-authorization failure and do not change roles.

Inspect authorization

Confirm the Terraform target before inspecting BTP:

subaccount_id="$(terraform -chdir=infra/btp output -raw subaccount_id)"
btp --format json get security/role-collection "Joule Developer" \
  --subaccount "$subaccount_id"
btp --format json get security/role-collection "Joule Developer" \
  --subaccount "$subaccount_id" --show-user-assignments true

Verify all of the following:

  1. Joule Developer contains end_user, extensibility_developer, and capability_admin from das-application.
  2. The affected user is assigned to Joule Developer.
  3. The assignment origin matches the IAS trust used for login, normally sap.custom in this Cookbook.

If all three are correct, do not change Terraform. Explain that the cached Joule token is stale, hand off ./scripts/joule-login.sh once, and stop.

Repair a missing assignment

Add the affected IAS user to the managed capability-deployer variable in the existing environment tfvars file:

joule_capability_deployer_users = [
  "user@example.com",
]

For the split infra/btp/stacks/joule deployment, use the equivalent variable:

capability_deployer_users = [
  "user@example.com",
]

Preserve existing users. Do not add unrelated Process Automation roles just to make Joule capability deployment work.

Create a saved plan with the same variable files used by the target account, then run the policy check. For the live Cookbook stack this is typically:

terraform -chdir=infra/btp plan \
  -var-file=live-test.tfvars \
  -var-file=live-joule.tfvars \
  -out=/tmp/joule-access.tfplan
infra/btp/scripts/check-plan.sh --chdir infra/btp /tmp/joule-access.tfplan

Require approval before applying the saved plan:

terraform -chdir=infra/btp apply /tmp/joule-access.tfplan

After a successful apply, hand off ./scripts/joule-login.sh once so the user receives a fresh token. Then verify joule -w list and retry the original compile or deploy command.

Stop conditions

Stop and explain the remaining administrative boundary when:

  • the BTP session is expired; ask the user to run btp login --sso;
  • the required das-application role templates are unavailable;
  • the IAS trust origin or Joule Studio App2App flow is not configured; or
  • the safe Terraform plan cannot isolate the intended role assignment.

Do not claim that Terraform can complete an IAS activation or tenant-specific App2App administration step that the SAP provider does not expose.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.