HomeGuidesAPI ReferenceGuidesMRT APIConfiguration API
GitHubAirheads Developer Community
Guides

MSP Workbench

Run common MSP tasks across your tenants with one MSP credential

📘

Source Code

You can find the full source code and documentation for this workflow on GitHub: MSP Workbench

MSP Workbench runs common MSP tasks across your tenants with one MSP credential, from a web UI or the command line. Every write goes through a read-only review and a single confirmation.

🚧

Note

This is a proof of concept built on PyCentral. Use it as a reference for your own MSP integrations, not for large-scale production use.

MSP Workbench flow

MSP Workbench flow

Each task has its own guide:

GuideWhat it does
Create MSP TenantsCreate tenant workspaces and provision Central
Add Devices to MSP InventoryAdd serial number and MAC address pairs to MSP inventory
Assign Inventory to TenantsAssign MSP-owned devices and subscription keys to existing tenants
Monitor TenantsView sites, devices, clients, and alerts across tenants
Subscription BurndownSee month by month which devices lose subscription cover

Prerequisites

  • uv. The workflow requires Python 3.10+, which uv installs on demand.
  • An HPE GreenLake MSP workspace with an API client credential.

Installation

  1. Clone the repository and enter the workflow:
git clone -b v2 https://github.com/aruba/central-python-workflows.git
cd central-python-workflows/msp-workbench
  1. Create the environment and install the dependencies:
uv venv --python 3.12
uv pip install -r requirements.txt

Credentials

MSP Workbench needs three values:

  • Client ID and Client secret: a GreenLake API client credential created at the MSP workspace level.
  • Workspace ID: the ID of the MSP workspace itself, not a tenant's.
👍

Tip

The MSP token exchange guide covers how to create an API credential and finding your MSP workspace ID.

You never enter a Central base URL; the cluster is found automatically.

In the web UI, enter them on the sign-in screen.

Sign-in screen

Sign-in screen

The command line reads them from token.yaml in the directory you run it from. Copy token.yaml.example to token.yaml and fill it in:

unified:
  client_id: <your-glp-client-id>
  client_secret: <your-glp-client-secret>
  workspace_id: <your-msp-workspace-id>  # the MSP workspace, not a tenant's

Start the Workbench

Start the server from the msp-workbench directory, then open http://127.0.0.1:8000/:

uv run python server.py
OptionDefaultDescription
--host127.0.0.1Address to listen on
--port8000Port to listen on
MSP Workbench hub

MSP Workbench hub

Demo Mode

Demo mode uses a fixed sample catalog, needs no credentials, and makes no live changes. The catalog has sample tenants, devices, and subscription keys that cover valid, insufficient-capacity, expired, not-yet-valid, and ineligible cases, plus Central data for monitoring.

  • Web UI: choose Use demo mode on the sign-in screen.
  • Command line: add --demo to any command.

Run a Job

Creating tenants, adding inventory, and assigning inventory all run the same way.

  1. Review. Click Run preflight. This read-only check shows what will be written, what is already done, and what is blocked.
  2. Confirm once. The confirm button, marked DEMO or LIVE WRITES, starts the run.
  3. Watch the run. Progress updates as each step finishes. Leaving the page does not stop the run.
  4. Stop, if needed. Stop after current step ends the run. You can't resume it; unprocessed items are marked skipped.
Live run

Live run

Writes go out in batches of five, and one job runs at a time. Jobs are kept in memory, so restarting the server loses them.

When the run ends, download its reports:

ReportFileContents
Download CSV reportonboarding-job-{id}.csvPer-device results of the run
Download failed devicesonboarding-job-{id}-failed-devices.csvOnly the devices that did not finish
Download manifestJSON manifestThe confirmed job, which the command line can plan and run again

To retry, fix the cause, then import the failed-devices CSV in the task's CSV import panel. The new run goes through review and confirmation again. Work that already finished is re-checked, not repeated.

Common results when a run writes devices:

CodeNext step
permission_deniedAsk a GreenLake admin for edit permission.
rate_limitedWait a few minutes.
transport_errorGreenLake did not respond; nothing is wrong with the devices.
ambiguous_writeGreenLake never confirmed the write; finished writes are re-checked, not repeated.
auth_requiredSign in again.
stoppedYou stopped the run; nothing to fix.

Command Line

The command line offers the same tasks, for example:

uv run python workbench.py --demo list tenants

list accepts tenants, services, devices, or subscriptions. These global flags go before the command:

FlagDescription
--demoUse the demo catalog instead of token.yaml
--verboseShow PyCentral INFO logs on stderr
--format json|tableOutput format (default json)
--fields PATHSComma-separated fields to keep in each list item, e.g. workspace_name,address.city
--limit N or --limit SECTION=NCap every list, or one section; repeatable
--out PATHWrite the output to a file and print a short receipt

Errors are printed as one JSON line on stderr with code, message, and hint. Exit codes:

CodeMeaning
0Success
1Local failure, such as a missing token.yaml or an invalid manifest
2Usage error, or confirmation required
3Not found, such as an unknown tenant
4Authentication or GreenLake/Central failure

Troubleshooting

ProblemFix
Sign-in fails with 401GreenLake rejected the credentials. Check the client ID, client secret, and that the workspace ID is the MSP workspace's, not a tenant's.
Sign-in fails with 409You cannot change sign-in while a job is queued or running. Wait for it to finish, or stop it.
Sign-in fails with 502GreenLake or Central returned an error. Read the message, then try again.
Port 8000 already in useStart the server on another port, e.g. uv run python server.py --port 8001.
UI returns 503The built UI (static/) is missing from your checkout. Restore it with git checkout -- static, or rebuild it with cd frontend && npm install && npm run build.
A job disappears after a server restartJobs aren't saved across restarts. Download reports first; after a restart, check GreenLake before re-running.
A run is slow or failingStart with MSP_API_DIAGNOSTICS=1 uv run python server.py and attach the MSP_API_DIAGNOSTICS lines from stderr (no secrets included).

Support


What’s Next

Did this page help you?