WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud Foundation
  • VKS
  • Homelab
    • Resources
    • Nested Virtualization
  • VMware Nostalgia
  • Apple
You are here: Home / Automation / Automation with the VMware Cloud Services Platform (CSP)

Automation with the VMware Cloud Services Platform (CSP)

07.24.2018 by William Lam // 4 Comments

I was recently doing some work where I needed to access the APIs for the VMware Cloud Services Platform (CSP). As the name suggests, CSP is where customers can manage access, billing and consumption of the various VMware SaaS offerings including VMware Cloud on AWS (VMC) and VMware Hybrid Cloud Extension to just name a couple.

CSP also provides a RESTful API (Swagger documentation here) which enables customers and partners to automate all aspects of the CSP UI. Although my use of the CSP API is quite small, I figure it  would useful to share the overall workflow in case others were interested in consuming the full CSP API.

The first thing you need is to retrieve the API Refresh Token which can be found by going to "My Account" in CSP and then navigating to the API Tokens as shown in the screenshot below. If you do not see a refresh token, simply generate one.


Once you have this refresh token, you will need to perform a POST to /am/api/auth/api-tokens/authorize to get back a CSP Access Token which will be used to authenticate yourself and be able to interact with the CSP APIs. To demonstrate this workflow, I have create two sample scripts below which takes a refresh token and returns the CSP Access Key and then perform a GET on /slc/api/definitions?expand=1 to use the key to list all CSP services (simliar to what you see when you first login to the CSP).

PowerShell

Here is an example PowerShell module VMware.CSP.psm1 which provides two functions: Get-CSPAccessToken and Get-CSPServices to interact with the CSP APIs:

Import-Module VMware.CSP.psm1
Get-CSPAccessToken -RefreshToken $RefreshToken
Get-CSPServices

Bash (cURL)

Here is a Shell script vmware-list-csp-services.sh which leverages cURL and jq to interact with CSP API:

./vmware-list-csp-services.sh $REFRESH_TOKEN

More from my site

  • Integrating VMware Cloud Notification Gateway with VMware Event Broker Appliance (VEBA)
  • Custom notification and automation based on host failure in VMware Cloud on AWS
  • ESX 3.x on VMware Cloud on AWS? 
  • Configuring Standalone vRealize Orchestrator with VMware Cloud on AWS
  • Automating HCX Multi-Site Service Mesh configuration using the new HCX PowerCLI cmdlets

Categories // Automation, PowerCLI, VMware Cloud on AWS Tags // Cloud Services Platform, CSP, VMC, VMware Cloud on AWS

Comments

  1. *protectedKunal Singh says

    06/25/2019 at 3:31 am

    You can find the VMC SDK in the following locations for Java and Python respectively
    https://github.com/vmware/vsphere-automation-sdk-java
    https://github.com/vmware/vsphere-automation-sdk-python

    Reply
  2. *protectedairSlate says

    09/10/2020 at 2:22 am

    Excellent solution. Thank you! Now there are dozens of cool process automation tools on the market that can significantly speed up many of the processes of your work with clients. The right software can increase the effectiveness of the entire team or free up time for something new

    Reply
  3. *protectedSimple app says

    05/25/2022 at 3:31 am

    Great! thank you for this useful information.
    Good job

    Reply
  4. *protectedStyngr Creators Fund says

    03/30/2023 at 8:49 am

    This has been very useful in my work. Thank you for the short but comprehensive information

    Reply

Leave a Reply to airSlateCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Search

Thank Author

Author

William is Distinguished Platform Engineering Architect in the VMware Cloud Foundation (VCF) Division at Broadcom. His primary focus is helping customers and partners build, run and operate a modern Private Cloud using the VMware Cloud Foundation (VCF) platform.

Connect

  • Bluesky
  • Email
  • GitHub
  • LinkedIn
  • Mastodon
  • Reddit
  • RSS
  • Twitter
  • Vimeo

Recent

  • Programmatically accessing the Broadcom Compatibility Guide (BCG) 05/06/2025
  • Quick Tip - Validating Broadcom Download Token  05/01/2025
  • Supported chipsets for the USB Network Native Driver for ESXi Fling 04/23/2025
  • vCenter Identity Federation with Authelia 04/16/2025
  • vCenter Server Identity Federation with Kanidm 04/10/2025

Advertisment

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

Copyright WilliamLam.com © 2025

 

Loading Comments...