SampleSampletypeA worked example you read or clone. Evidence: it demonstrates, it never provides.See every one →What this type is →by SAPby SAPoriginPublished by SAP itself. A visible facet, never an input to a reading — a dormant official plugin reads exactly like a dormant independent one.See every one →Starting point

SAP-samples/application-vulnerability-report-scan-user-automation

A Python script that assigns Application Vulnerability Report's scan technical user as SpaceAuditor to every Cloud Foundry space in an SAP BTP global account.

Application Vulnerability Report needs its scan technical user to hold the SpaceAuditor role in every space it is meant to scan, which otherwise means repeating the same role assignment by hand across every organisation and space in a global account. The script logs in to the btp CLI and each Cloud Foundry endpoint over SSO, lists every subaccount, organisation and space, assigns the role to application-vulnerability-report-scanner@sap.com in each one, and prints a summary of what it changed and any errors. It is offered as an example to review and adapt rather than a maintained tool, and runs on macOS or Windows with Python 3.13 or newer and the BTP and Cloud Foundry CLIs installed.

Facts

Last pushLicenceApache-2.0

Where it sits

Lives in
Demonstrates
Account provisioningBTPAccount provisioningcapabilitySetting up cloud accounts, their organisational structure, resource entitlements, subscriptions and access assignments so the setup can be repeated from code. [Deployment](capability:deployment) puts an application onto a runtime that this account structure makes available.

Who is behind it

SAP SamplesSAP SamplesOrganisationMaintains this
In the atlas: maintains 222
@SAP-samples
maintainerFabian SpechtPersonContributes to this
In the atlas: contributes to 1
@Fabiann2205
1 contributor

What it declares

Every artifact

Type
Sample
Origin
By SAP

As a sample

Form
does not say

Connections1

SAP-samples/application-vulnerability-report-scan-user-automation connectionsSAP-samples/application-vulnerability-report-scan-user-automationPROVIDES→ demonstrates1demonstrates authoredAccount provisioning

README

quoted from SAP-samples/application-vulnerability-report-scan-user-automation under Apache-2.0, read
SAP-samples/application-vulnerability-report-scan-user-automation/README.mdOn GitHub

BTP Technical User Assignment Script Example

REUSE status

Description

This script is a helper script for the Application Vulnerability Report for SAP BTP. It assigns the required technical user as SpaceAuditor to all spaces in all Cloud Foundry (CF) organizations within a BTP global account.

It should be used as an example and adapted as needed. Use it on your own risk after reviewing the code.

  • Technical user: application-vulnerability-report-scanner@sap.com
  • Works on macOS and Windows

Requirements

  • macOS or Windows system with Python 3 installed (Python >= 3.13) (Get Python)
  • Installed CLIs:
  • Permissions:
    • Org Manager role in each relevant CF organization
    • Space Manager role in each relevant space
  • Single Sign-On (SSO) access for BTP and CF

Download and Installation

Download the script file add_technical_user_to_spaces.py from the repository to your local machine. Then run the following command to start the script:

python3 add_technical_user_to_spaces.py

On start, the script asks for the BTP CLI URL. Either choose production, canary or provide a custom URL.

It then initiates BTP SSO login. For that a browser window will open.

After successful login, select the target global account.

After that it will run the btp target command so that you will be able to change the global account later if needed. If you don't want to change, just press Enter.

The script will then automatically:

  • List all subaccounts in the global account.
  • For each subaccount with CF environment:
    • List all CF instances (endpoints).
    • For each CF instance:
      • Log in to the CF endpoint via SSO. You need to open the link in a browser and copy the code back to the terminal. This happens for each CF endpoint you have access to.
      • List all organizations.
      • For each organization:
        • List all spaces.
        • For each space:
          • Assign the technical user as SpaceAuditor.

At the end a summary is printed with counts of processed subaccounts, CF instances, organizations, spaces, successful assignments, and any errors encountered.

Troubleshooting

  • BTP login fails:
    • Check network/SSO and retry: btp login --url https://cli.btp.cloud.sap/ --sso.
  • No subaccounts found / parsing errors:
    • Use the latest BTP CLI; table outputs may change.
    • Test with: btp list accounts/subaccounts and verify headers.
  • "Authorization failed" for environment instances:
    • You lack subaccount permissions. The script will skip the subaccount and list it in the summary.
  • CF login fails:
    • Check CF SSO and endpoint, try manually: cf login -a <api> --sso.
  • No spaces listed:
    • Verify you’re Org Manager or Space Manager in the organization.

How to obtain support

Create an issue in this repository if you find a bug or have questions about the content.

For additional support, ask a question in SAP Community.

Contributing

More information about contributing can be found here.

License

Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. This project is licensed under the Apache Software License, version 2.0 except as noted otherwise in the LICENSE file.

Apache-2.0, read

Details

Sources3
Added by handdiscovered herechecked
README.mdquoted, and what the entry declareschecked

Sources are graph entities: the same page may back several entries, and an unreachable source flags every row that rests on it.

Compatibility and provenance
discovered viaAdded by hand
first seen in the atlas
ecosystem and domainbtp, operations-and-runtime
Contributors1

From the repository’s contributor list, .

History in the atlas1
  1. First seen.
For your agent
Ref
artifact:sap-samples-application-vulnerability-report-scan-user-automation
JSON
/artifacts/sap-samples-application-vulnerability-report-scan-user-automation.json
MCP
Connecting an agent